Using the command line is a time-honoured tradition in Linux (at least for those that like to get their hands dirty with commands). One of the common acts carried out when using the CLI is that of displaying and manipulating texts, and Linux is so much rich with commands to achieve this. The cat command is a very good example.
The cat command is used to display the content of a file on screen. However, if the file being displayed is large, then the entire content will scroll up the screen. To view the file one screen-full at a time, you can use the more or less commands;
THE more COMMAND
The more command is to display data one screen-full at time while viewing a file using the more command, once you have scrolled down you cannot move up
More <option> <filename_of_any_textfile>
The above command will display a page—wise (text divided based on the size of the screen viewed one screen-full at a time) listing of the contents of the file.
THE less COMMAND
The less command is similar to the more command except that you can scroll upwards also while viewing the contents of a file. The less command is also a little faster than the more command.
less <options> <filename_of_textfile>
They can prove very valuable because both commands (more and less) can also be used to read the outputs of commands that can span more than one page. Examples include the following;
env | more or env | less
dmesg | more or env | less
tree | more or tree | less
After using the less or more; to move up and down the screen, you can use the arrow keys. You can also specify a number to move down the screen by that number of lines. To quit the display, you have to type ‘q’.
Happy Linux’NG!
- Time complexity analysis: How to calculate running time - April 1, 2024
- Sovereign Tech Fund Invests €1M In GNOME’s Open-Source Project - November 19, 2023
- Google’s Bard AI: ChatGPT Rival or The Next Frontier in AI and NLP Technology - February 8, 2023