Introduction Linux text file viewer command: cat, more, lesss
Tools / materials
-
ubuntu16.04
Method / Step
-
There are three command in Linux can be used to view the contents of a text file:
(1)cat
(2)more
(3)less
You can use man cat or more or less see the corresponding manual
-
The cat command is used to display all the contents of a text file
(1) cat file_name displays the text content of all
(2) cat -n file_name give all lines with line numbers
(3) cat -b file_name only to have a line of text with line numbers
(4) cat -T file_name keep tabs appear in text, using alternative ^ I
Figure:
-
more command also displays the contents of a text file, which is a pager utility after executing the command will stop after displaying each page of data
As shown, the input has a more prompt file_name bottom, still more program displays the current text position and which
: You can flip through the spacebar or Enter key progressive way forward browse file contents, To exit, press q to exit
-
less command is an upgraded version of the more command to achieve a flip around the text and some advanced search features
less command, right up and down keys and the up and down keys
As shown, the input commands can be less filename flip up and down keys
At the bottom of the input / xxxx (character) can implement search functionality
Exit can press q