This article summarizes the following commands:
Wc:word Count
-L: Shows only the number of rows
-W: Show Only words
-c: Show byte size only
Cut: (remove sections from every line of files) deletes a fixed portion of each row of the file, used to match the separator, and then filters the desired column contents
-D: Specify separator
-F: Specify the fields to display
M: Column M
M,n: Subsections m and N columns
M-n: M to nth column
Sort sorting
-F: Ignore character case
-T: Specify separator
-K: Specifies the location number of the separator
-N: Sorting by numeric size
-U: Sort after to heavy
Uniq:(report or omit repeated lines) reports or ignores duplicate rows, easy to ignore-C, can count repeat times
Practice:
1. Display the shell of each user on the current system;
# cut-d:-f1,7/etc/passwd
2. Display all kinds of shell used by all users on the current system;
# cut-d:-f7/etc/passwd | Sort | Uniq
3. Remove the 7th line of the/etc/inittab document;
# Head-n 7/etc/inittab | Tail-n 1
4, remove the user name of the 7th user in the/etc/passwd file;
# Head-n 7/ETC/PASSWD | Tail-n 1 | Cut-d:-f1
5. The number of files that start with the case of P-/etc in the statistics directory;
# ls-d/etc/[pp]* | Wc-l
Note : More wonderful tutorials Please pay attention to the triple computer tutorial section, triple Computer office group: 189034526 welcome you to join