Cut to segment a file
Cut-d: (Specifies the delimiter)-f (paragraph) 3,4,5/etc/passwd
CUT-C (intercept the first few characters) 1-10/etc/passwd
Sort used for sorting
SORT-T: (Specifies the delimiter)-K3 (paragraph)-N (Pure numeric sort)/etc/passwd
SORT-T: (Specify delimiter)-k3,5 (interval segment with, number, not used-)-N (Pure numeric sort)-R (reverse order)-U (de-duplication)/etc/passwd
Wc-l (number of lines in a document) 1.txt 2.txt
Wc-w (How many word words) 1.txt
Wc-m (number of characters, including one \ n) 1.txt
Uniq is mainly used to repeat.
Uniq-c (calculates how many repetitions) 2.txt if two duplicate rows are not next to each other, it is not going to repeat.
Sort 2.txt|uniq-c
Tee for redirection plus dual output
echo "Xuan" |tee 1.txt (redirect Xuan to 1.txt and then display Xuan on the screen)
TR is used to replace characters.
LS *.txt |tr ' A-Z ' A-z ' lowercase to uppercase
LS *.txt |tr ' abcde ' ABCDE ' one by one corresponds to the
Split is used to cut large files.
Split-b (according to size) 50m 1.txt
Split-l (according to line) 1.txt
The source file still exists after cutting
Split-l (according to the line) 1.txt +new_ (file name after cutting)
&& ls 1.txt && ls 2.txt #左边命令执行成功后 to execute the command on the right
If the previous command executes successfully, the subsequent command is executed, and if the previous command execution is unsuccessful, the subsequent command is no longer executed
|| or ls 1.txt | | LS 2.txt #左边命令执行不成功 to execute the command on the right
If the previous command execution is unsuccessful, the following command is executed
; The left command executes successfully, and the command behind it will execute
Cut,sort,wc,uniq,tee,tr,split, and, and, or