1. Cat commands for viewing plain text files (shorter), format: "cat[options [File]"
View text files
Cat file name
Cat parameters
Parameters |
Role |
-N |
Show line Numbers |
-B |
Display line numbers (not including spaces) |
-A |
Displays invisible symbols, such as spaces, tab |
|
|
2. The more command is used to view plain text files (longer) format: "more[Options" File "
View text files
[[email protected] etc]# more file name
More parameters
Parameters |
Role |
-Digital |
Number of pre-displayed rows (default is one page) |
-D |
Display prompt statement and error message |
3. Head command to view the first n rows of text
View the first 20 lines of text
Head Ten file names
Head command
Parameters |
Role |
-N 10 |
Show 10 rows |
-n-10 |
Normal output without showing the last 10 rows |
4. Tail view Plain text documents with the following n-line format: "tail [options] [file]"
View the following 20 lines of the text file:
Tail - Filename
Tail parameters
Parameters |
Role |
-N 10 |
Show back 10 rows |
-F |
Refresh the displayed content continuously |
5. The TR command is used to convert characters in a text file in the format: "tr[original character [target character]"
Cat tr. Tex | TR [A-z] [A-z]
6. The OD command is used for viewing files in special formats. Format as "od[options [File]"
7. The WC command is used to count the number of lines, words, and bytes of the text, formatted as: "wc[parameter] text"
WC command
Parameters |
Role |
-L |
Number of rows displayed |
-W |
Show only the number of words |
-C |
Show only bytes |
View the number of users in the current system
WC -l/etc/passwd
8. Cut
9. The diff command is used to compare multiple file literals in the format: "diff[parameter] file"
Diff parameter
Parameters |
Role |
-B |
Ignore differences caused by whitespace |
-B |
Ignore differences caused by whitespace |
-brief OR-Q |
Report only if there is a discrepancy |
-C |
Use context output format |
Compare the differences between 2 files
[Email protected] etc]# diff Diff_a.txt diff_b.txt
Show only the comparison results, same or different
diff --brief Diff_a.txt diff_b.txt
LINUX-12 Basic command of Cat,more,head, tail, Tr,od,wc,cut,diff