There are various ways to view text files in Linux terminal.
When you are new to Linux, you try to use the cat command all the time to read the content of a file. This works great for files with only a few lines out of output, but larger files quickly scroll content past the user making it difficult, or even impossible for you to find what you need.
Cat Command Problem
The cat command is certainly not very practical for viewing large files. You don’t want your entire screen to be filled with the file content.
What you can do here is to use either ‘less command’ or ‘more command’. We’ve already covered the less command on Linux Handbook so I am going to show you how to use more command in this tutorial.
Using more command to read text files in Linux terminal
The more command opens a text file in page views. You can read page by page and when you quit more, there will be no output visible on the screen. Your terminal will be clean and pristine.
More More View
Navigating through more
With more you are able to easily scroll through data one page at a time. You can use the following methods for navigation.
|Down Arrow / Space Bar||Scroll Down (One Page)|
|Up Arrow / B||Scroll Up (One Page)|
|Enter||Scroll One Line at a Time|
|– number||The Number of Lines per Screenful|
|+ number||Display File Beginning from Line Number|
|+/ string||Display File Beginning from Search String Match|
|q||Quit viewing the text file and return to screen|
While using more, you can enter q to quit at anytime or h to display the built-in help.
Display n number of lines per screen
Typing an -n (where n is an integer) after the command will display only n number of lines as a page.
more -n filename
Move 2 lines at a time
Skip the first n number of lines
Typing +n (where n is an integer) after the command will skip to that line number before displaying your content.
more +n filename
Search for a string using more command
You can skip to the first instance of a specified string using +/string after our command.
more +/string filename
To find the next instance, you can type /string inside the more view to search.
Skip multiple blank lines with -s option of more command
If you have multiple blank lines together, you can trim them into a single blank line with option -s.
more -s filename
Run more command with help options displayed
If you are new to more, you can run it with option -d. This way, it keeps on showing help for navigating.
In addition to that, if you used any illegal character or command in more view, it suggests using help methods using h which displays detailed instructions for navigation or exit.
There are also a few more tricks and tips included that you can look at. Of course, you can always look at man page of more command for details.
-d display help instead of ringing bell
-f count logical rather than screen lines
-l suppress pause after form feed
-c do not scroll, display text and clean line ends
-p do not scroll, clean screen and display text
-s squeeze multiple blank lines into one
-u suppress underlining
// from the detailed instructions page accessible via h while running
Display next k lines of text [current screen size]
z Display next k lines of text [current screen size]*
Display next k lines of text *
d or ctrl-D Scroll k lines [current scroll size, initially 11]*
q or Q or Exit from more
s Skip forward k lines of text 
f Skip forward k screenfuls of text 
b or ctrl-B Skip backwards k screenfuls of text 
‘ Go to place where previous search started
= Display current line number
/ Search for kth occurrence of regular expression 
n Search for kth occurrence of last r.e 
! or :! Execute in a subshell
v Start up /usr/bin/vi at current line
ctrl-L Redraw screen
:n Go to kth next file 
:p Go to kth previous file 
:f Display current file name and line number
. Repeat previous command
Personally, I prefer using less command over more command.
I hope this tutorial gave you enough to survive the more command. I welcome your questions and suggestions.
Christopher works as a Software Developer in Orlando, FL. He loves open source, Taco Bell, and a Chi-weenie named Max. Visit his website for more information or connect with him on social media.
Liked the article? Please share it and help us grow 🙂less and more command in linux,use of less and more command in linux