I. Common commands
Cat: Prints the contents of the entire file starting from the first line.
TAC: Outputs the contents of the entire file starting from the last line.
MORE: Displays one page of the file according to the window size.
Less: Much the same as more, but more convenient in terms of search and paging.
Head: Outputs the first 10 lines of the file from the beginning of the line.
Tail: Displays the bottom 10 lines of the file.
NL: Similar to the CAT-N function, outputs the entire file from the first line and displays the line number.
Rev: Displays the contents of the file from right-to-left flashbacks.
Two, the comparison of pairs
1. Cat and TAC, TAC and Rev
Cat: Prints the contents of the entire file starting from the first line. For small files, use a lower screen. Format: Cat parameter file name
TAC: Outputs the contents of the entire file starting from the last line. For small files, use a lower screen. Format: TAC parameter file name
Rev: Displays the contents of the file from right-to-left flashbacks. For small files, use a lower screen. Format: Rev file name
Cat vs TAC: These two commands are very interesting, and the order of viewing the contents of the file is reversed, and the command is written in reverse, which is amazing.
TAC and Rev: Both of these commands are not the usual way to view the contents of the file are backwards. Bloggers used to remember the two names, but it was easier to memorize them with cat.
2, more and less
MORE: Displays one page of the file according to the window size. Format: more file name.
More common shortcut keys for viewing: Enter to view n rows, n can be customized, default setting is 1.
Ctrl+f or SPACEBAR to view a single screen of the current window size.
Ctrl+b returns the contents of the previous screen view, = outputs the line number of the current line.
: F outputs the currently viewed file name and the current line number.
V Call VI Editor,! Call Shell and execute command, Q exit more view
Less: Much the same as more, but more convenient in terms of search and paging. Format: less file name.
Less common shortcut keys for viewing: The more You can use, the less you can use.
"PageUp" looks forward to a page of content, "PageDown" to view one page backward.
The string you want to find finds the string you want to find.
3. Head and tail
Head: The first 10 lines of the output file start from the top line, typically used to find the first number of rows. Format: Head parameter file name
Tail: Displays the bottom 10 lines of the file, typically used to find the last number of rows. Format: Tail parameter file name
Contrast: Head and tail Use the opposite, one is from the beginning, one is to view the end of the specified number of rows.
Common file view commands for Linux basics