Text File View commands: Cat, TAC, more, less, tail, head
Cat: Start all of the file contents from the first line
TAC: Displays the contents of all files from the last line
MORE: Page-by-page display of file contents
Less: page-by-page display of file content, but allows page forward
Tail: Show only a few lines at the end
Head: Show only the first few lines
The cat command is a concatenate (continuous) shorthand for displaying the contents of the entire file on the screen, so the cat command has a question
, that is, when the entire file content is more than the screen size, we can only see the last display on the screen content, before the display
The results are too late to see.
The TAC command is exactly the opposite of the cat command (as can be seen from the name), and the TAC command starts the file contents consecutively from the last line of the file.
displayed on the screen content.
CAT,TAC command
Syntax: [OPTIONS] ... FILE:
Common parameter Options
-A: Show all content
Example:
#cat-A/etc/passwd
More, less
Syntax: more [OPTIONS] ... FILE ...
Common parameter Options
-D: Display page with Exit prompt
Space: one screen backward;
Enter: one line backward;
B: one screen ahead;
Example:
# More-dc/etc/profile//Display prompt, and display from the terminal or the top of the console;
# more +4/etc/profile//starting from the 4th line of the profile display;
# more-4/etc/profile//Display 4 rows per screen;
Syntax: less [OPTION] ... FILE ...
Common parameter Options
Text Search:
/keyword
? KEYWORD
N: Next with the same direction as the command;
N: The previous one in the opposite direction of the command;
Example:
# less-n/etc/profile//Display line number
Tail,head: It's easier to use
Syntax: Head [OPTION] ... FILE
or tail [OPTION] ... FILE
Common parameter options:
-N #: Display before # line or after # line
Example:
# tail-n 5/etc/profile//Display the last 5 lines of the/etc/profile
# Head-n 5/etc/profile//Show front 5 lines of/etc/profile
-#
Time Stamp management tool: Touch
Syntax: Touch [options] ... File..
Common parameter options:
-A: or--time=atime or--time=access or--time=use only change the access time.
-D: Use the specified date time instead of the current time.
-M: or--time=mtime or--time=modify only change the change time.
-T: Use the specified date time instead of the current time.
Each file has three timestamps:
Atime: The last time the file was visited;
Mtime: The last time the file was "modified";
CTime: The time the file was last "changed";
This article is from the "10,000-hour Law" blog, be sure to keep this source http://daisywei.blog.51cto.com/7837970/1687816
Text File View commands: Cat, TAC, more, less, tail, head