There are many GUI text editors available on a Linux system to view and modify text files.
But you might just want to read your text files within the terminal.
What Is the less Command?
lessis a Linux command used for filtering and viewing text files one screen page at a time.
It is more advanced than the more and most commands.
It offers a lot of options and interactive features to make your experience more satisfying.
Thesudo.conffile is used to configure the sudo front end, and it has 139 lines.
This file is present in almost every Linux-based operating system.
you might also use any text file of your choiceas long as it has over 60 lines.
To move forward a line at a time, press theDownkey orSpace.
To move backward by a line, press theUpkey.
To move forward by a page, pressB.
To move forward several lines, hitB, then key in the number of lines.
To move backward by a page, pressD.
To do this, add the-Noption when running the command.
When it finds the string, it will highlight the results in yellow.
Let’s search for the word:plugin.
If you search forplugin, the output should look like this:
What Is the more Command?
Themorecommand lets you view text files in your terminal one screen page at a time.
This command works just like the less command but only with fewer functionalities.
Using the Default more Command
For this example, we will use thesudo.conffile found in the/etcfolder.
It is not available in all Linux distributions by default, so you may have to install it yourself.
To peek if it is installed, typemostinto your terminal.
If it is not installed, your system will ask if you want to install it.
The Default most Command
The default most command prints out the first page of the text file.
Try it out with:
The output is quite different from the less and more commands.
At the bottom, there’s a blue line showing the name of the file and other helpful commands.
The pipe symbolredirects the output of one command as an inputto another.
Some of them include cat, echo, head, and tail.
They all fulfill different purposes with their unique features.