Linux view the contents of the file command (cat, more, less, head, tail)

The cat command

Purpose: To display the contents of files
cat [options] filename ...
example
[root @ localhost ~] # CAT / etc / hosts
[root @ localhost ~] # CAT / etc / sysconfig / Network

Cons: In the character interface, if the content exceeds the maximum number of rows displayed on the screen, it will only show the last number of lines that can be displayed.

more command

Uses: full screen page display file contents
more [options] filename ...
interactive mode of operation
press the Enter key to scroll down line by line.
Press the spacebar to turn down a screen,
press q to exit

Cons: When the end of the line and then turn to the next page will automatically exit, no longer page up.

less command

Purpose: the more command the same, but more extensions
less [options] filename ...
interactive mode of operation
Page Up Page Up, Page Down Page down
press "/" key to find the content, the content of the next "n" , the contents of a "N"
other features and more similar to the basic command

head command

Purpose: to view part of the beginning of the file (the default is 10 lines)
head -n filename ...

tail command

Uses: view the contents of a small number of files ending (the default is 10 lines)
tail -n filename ... or tail -n filename ...

Guess you like

Origin blog.51cto.com/14449798/2429181