The cat command is all well and good for small files. But, if the file is large, the contents will zoom past and we’ll only see the last screen worth of content. One way to overcome this is by using the more command.
The more command displays the contents of the file one screen at a time for large files. If the contents of the file fit a single screen, the output will be the same as the cat command.
Example:
$ more pom.xml
Note the text “–More–(46%)” at the end of the output. Here, the text “(46%)” tells us that the file is big and we’re currently seeing only 46% of the content. This percentage will increase as we traverse through the file.
The cursor will stay at the end of this text. Then, we can scroll through the contents of the file using the Enter key, one line at a time.
We can also scroll through the file page by page by using the Space bar. And to scroll back to the previous page, we can use the b key. We’ll use the q key to go back to the command prompt
$ more -5 pom.xml
Only 5 lines at a time
$ more +10 pom.xml
Start from the 10th line
$ more +/shashi file1.xml
Start from the first occurrence of the word “shashi” in the file.