Home > OS >  Linux basic instruction
Linux basic instruction

Time:10-21

Example 1, mkdir make directorys create the directory: mkdir/data to create a data directory under the root/
2, Is the list (list) list directory file example: 1 s/column/root directory and file directory,
- l (long) format, long - d (directorys) directory
3, CD change directory change directory path example: CD/etc
4, the PWD print work directory print working directory (display the current path)
5, touch to create file or update the timestamp of the file, if the file does not exist, create a new file, if present,
Change the file access time atimer timestamp information, such as
6, vi Windows notepad, simple, example: vi DZQC. TXT
7, complexity in vim editor function, highlighting, automatic indentation (write the shell/python scripts with)
8, echo print content, cooperate & gt; "" Or & gt; & gt;" Cover and additional content for file, and a more complex not commonly used similar to the printf command.
"& gt;" Mean value orientation, will erase all previous data in the file
"& gt; & gt;" Appended at the end of the file to generate additional content, only need to the content of the
Special notation:
Or 1 & gt; Output redirection: behind your front output input into the file, will remove the original file
> Or 1 & gt;> Additional redirection: behind your front output is appended to the file tail, not clearance documents original content,
0 & lt; Or & lt; Input redirection: input redirection is used to change the input command, the specified input, the front with the file name,
0 & lt; 2> Error redirection: the error information into the field of the file, will delete files original content,
2> Error appending redirection: behind the error message is appended to the file, the original content does not delete files,
Description:
1, the arrow is pointing to the flow of data,
2, digital illustration: left
1. The standard input (stdin) : the code is 0, use & lt; Or & lt; <, the data flow from right to left,
2. The standard output (stdout) : normal code is 1, use & gt; Or & gt;> , the data flow from left to right,
3. The standard error (stderr) : code is 2, use 2 & gt; Or 2 & gt;> ,
Example: left
[root @ songls DZQC] # xargs - n 2 & lt; B. TXT
Special redirect for example
A. the standard output to b.t xt, the error output redirected to a.t xt
Example: echo 'aaaaaaa 2 & gt; A.t xt 1 & gt; A.t xt
B. 2 & amp; 1 writing is the standard error is redirected to standard output, which make the output of the error and correct, the correct orientation, wrong is to,
Example: echo 'aaaaaaa & gt; A. TXT 2 & gt; & 1
C. 2 & amp; The method of equivalent to 1 & gt; &
Example: echo 'aaaaaaa & gt; A.t xt 2 & gt; & 1 is equal to the echo 'aaaaaaa & amp;> A.t xt
9, the cat to check the file content examples: cat DZQC. TXT
10, xargs from mark your input for content creation and execute commands - n Numbers, grouping
11, cp copy copy a file or directory, default cannot copy directory,
- r: recursion, used to copy the directory: - a: the equivalent of PDR,
- p: along with the file attributes of the copy in the past, rather than using the default attribute
12, the rm remove delete the directory and file
- f (force), compulsory - r (recursive) recursion, used to delete the directory
Stressed: delete command to be careful, very dangerous, must backup first before deleting a
13, mv move move a file or directory
14, * * * * find find -type file types (f (file), d (directory), c (character)
B (block), s (socket), l (link)), - the name "file name",
- mtime time, according to the modified time lookup, time number, + 7 seven days ago, on the seventh day, and seven 7 days recently,
15, * * * * * grep Linux three musketeers old filter the content of the need, -v ruled out content, example: grep -v DZQC test. TXT
- in addition to display the matching line B, and display the bank before the num of lines
-a besides show that match A line, and according to the bank after the num rows left
- C in addition to display the matching line, and display the line after the bank before the num left
16, the head head, the first n lines of the head read the file, the default in the first 10 lines, -n Numbers, habits - 5, ignoring - n.
17, tail tail, tail after n line of the output file, the default after 10 lines, -n Numbers, habits - 5, ignore the -n, small
18, alias view and set the alias view alias type alias directly, set an alias alias cp=cp -i
19, cancel the alias unalias unalias cp
20, seq: arithmetic progression, 20 seq seq 1 2 1 20 seq 100 & gt; Ett. TXT

3.2, xshell commonly used shortcut summary (many) off one part of
The TAB for completion
Ctrl + a to quickly switch to the command line start
Ctrl + e to switch to the command line at the end of the
CTRL + l CLS
Up arrow up command record
Down arrow scroll down command record
Ctrl + r to look for in the command history
Ctrl + u delete all the previous cursor characters
Ctrl + k to delete all characters after the cursor location
CTRL + w to delete the cursor before a word
Ctrl + d to end the current input, exit the shell
CTRL + s can be used to stay in the current screen refresh CTRL + q resume
  • Related