Commonly used text processing commands, input and output redirection, the pipe cat is the abbreviation of concatenate, show text more file name when the content of a file exceeds one screen, we can use the more command to view the file content on a screen. The less file name has the advantage of one row and one row compared with the more command. More is a one-page view, I personally feel that the two command functions are similar. Cpcp is short for copy. It can be used to copy one file into another. Therefore, cp commonly used text processing commands, input and output redirection, and pipelines
Cat is the abbreviation of concatenate and displays text
More file name
When the content of a file exceeds one screen, we can use the more command to view the file content on screen.
Less file name
Compared with more, he has the advantage of reading data in one row. More is a one-page view, I personally feel that the two command functions are similar.
Cp
Cp is short for copy. It can be used to copy one file into another. Therefore, the cp format should be cp [source file] [target file]. Cp is equivalent to copy in dos. (-R or-R recursion)
Recursion means that if there is still a directory in that directory, all copies will be made layer by layer.
Mv
Mv is the abbreviation of move. It can be used to move a file to another location. At the same time, the file name can be changed during the moving process. When the target file name is different from the source file name, the mv plays the role of rename.
Rm
Rm is the abbreviation of remove. It can be used to delete an object. Rm is equivalent to delete in dos. If you delete a directory, use-r to recursively delete it.
You can also use-I interactive deletion, that is, the system prompts you to delete
Alias command to view aliases
Wc
Wc is used to count the number of lines (-l), number of words (-w), and number of characters (-c) of a file and send it to the standard output.
Convenient for Statistics
Grep
Grep is used to find the row matching the specified keyword from a file and send it to the standard output. It is usually used to filter and search based on pipelines.
Head
Display the content at the beginning of the file. By default, ten lines of parameters -- lines or-n are displayed to indicate the number of lines to be displayed.
Tail
Tail displays the content at the end of a file. The parameter-f is used to display real-time updates to a file, which is used to monitor log files.
The tail-f command is generally used to monitor log files.
Sort
Sort is used to re-arrange text based on various needs. It is generally used after a pipe
By default, sort arranges text alphabetically.
-N: sort by number
-R reverse sorting
-U removes duplicate rows
Diff-Report Text differences
Uniq-Remove duplicate rows in the file
Cut-show a column in the file
Paste-concatenate text by Column
Diff
Diff compares the differences between two files and sends them to the standard output. The output first reports which line of the two files is different.
This command tells you which lines of file1 and file2 need to be modified to make the two files consistent.
# Diff file1 file2
The row number (n1, n2) before the letter (a, d, and c) is for file1, And the row number (n3, n4) after it is for file2. Letters a, d, and c indicate the attaching, deleting, and modifying Operations respectively.
Uniq
Uniq is used to remove duplicate rows in text. The-u parameter can only display rows that have not been repeated. -D: displays duplicate rows.
Display the second column of PASSWD, import it to the file, perform operations on your own, and view the file content.
Eg: # cut-f 2-d:/etc/passwd> file
This command will be useful in server setup in the future. Remember,-D is followed by the separator-f is followed by the nth line and then redirects