The pager programs like more, less, and “
most” are often used to fit the output of a particular command that is too big to fit on one screen. So, what is the difference between them?
- more: It’s the oldest utility shipped with major Linux distributions but lacks a few features, like the ability to scroll down but not up.
- less: It can be said to be a superset of more command that includes many more features that more command lacks.
- most: It is not the extended version or improvement of “
more” or “
less“, but a totally different program that’s capable of viewing any number of files as long as each window is at least 2 lines long.
Features of More Command
A few more features that it is capable of doing are:
- Displaying multiple files at a time.
- Truncates the long lines instead of wrapping them.
- Provide left-right scrolling mechanisms.
- Capable of reading gunzip-compressed files before decompressing.
- Displays more information on status than its alternatives.
- Passes raw escape sequences by default.
- Support built-in file editing.
- Split into multiple windows.
|Root or Sudo Privileges||No|
|Host System and Architecture||Ubuntu 22.10 (x64)|
|OS Compatibility||Ubuntu, Manjaro, Fedora, etc.|
|Discussed Tools in this Article|
Installing the “most” Command in a Major Linux System
Most Linux distributions do not ship the “
most” command by default with their operating systems, but instead provide it in their repository that you can use to install it using their default package manager.
Execute any one of the following commands to install it on your Linux system.
$ sudo apt install most #On Debian and Ubuntu $ sudo dnf install most #On Red Hat and Fedora $ sudo pacman -S most #On Arch and Manjaro
Verify the existence of this program by executing the following command after it’s successfully installed on your Linux system:
$ most --help
Syntax of the “most” Command
The most command takes two arguments: one is the option, and the other is the file name (or path pointing towards the file).
$ most [OPTION] [FILE]
The following are known options that will come into play while using this program:
|It used to display files containing 8 bit characters.|
|Force to search the string with case-sensitivity.|
|Remove the color from the output.|
|Disable the use of MMAP files.|
|Squeeze multiple blank lines into one.|
|Strictly disable the support for UTF-8 mode.|
|Force to use UTF-8 mode (By default, it uses the current locate to determine.)|
|Wrap the lines by placing a “|
|Remove the “|
|Turn off the gunzip-on-the-fly|
|Start at the specified line number.|
|Start from the line containing the specified |
The following are known commands that will come into play while using this program:
|Down arrow, Ctrl+n, Enter, or V||Move one line forward.|
|Up arrow, Ctrl+p, or ^||Move one line backward.|
|Right arrow, Tab, or >||Scroll left (when lines are not wrapped).|
|Left arrow, Ctrl+B, or <||Scroll right (when lines are not wrapped).|
|T, Escape+<||Go to the first line in the file.|
|B, Escape+>||Go to the last line in the file.|
|R, Ctrl+r||Redraw (or refresh) the window.|
|J, G||Prompt for line number, then jump to that line.|
|%||Prompt the percent number, then jump to that percent of the file.|
|h, Ctrl+h||Display the help window.|
|f, /, or Ctrl+f||Prompt for a string and search forward from the current to the nth element containing the specified string.|
|?||Prompt for a string and search backward from the current to find lines containing the specified string.|
|n||Use to move forward or backward based on the (f, /, or Ctrl+f) or “?“.|
|Ctrl+x 2, Ctrl+w 2||Split the window in half.|
|Ctrl+x o, Ctrl+w o||Jump to another window.|
|Ctrl+x 0, Ctrl+w 0||Delete the active window.|
|Ctrl+x 1, Ctrl+w 1||Except active, delete all other windows.|
|E, e||Open the current file in your default editor.|
|:n||Move to the next file (when multiple files are opened).|
|q||Quit the most.|
Opening a Single or Multiple Files
When you specify a single file (or a path pointing towards a file) as an argument to most commands, it will open it in an interactive mode, as shown.
$ most article.txt
However, the main benefit of using this command is to open multiple files (using space as a separator) and switch between each of them using the “:n” command.
$ most article.txt shortfile.txt
Splitting the Window in Half
Use the “Ctrl+x 2” or “Ctrl+w 2” command to split the current window into two different windows (effective when multiple files are opened), as shown.
Then use the “Ctrl+x o” or “Ctrl+w o” command to jump back and forth between each window.
If you have opened multiple files, then use the “
:n” command to switch to the next file.
Lastly, use the “Ctrl+x 1” or “Ctrl+w 1” command to close the active window.
Opening the File from a Specific Line
Use the “
+[N]” option and replace the “
N” with the line number that will be used to jump when the file opens.
$ most +10 article.txt
The above command will open the file on the 10th line.
Squeezing Multiple Blank Lines into One
If your file contains multiple blank lines, then the “
-s” flag will squeeze/combine each blank line into one single line.
$ most -s article.txt
Wrapping the Lines
-w” flag will wrap the lines within the screen size that do not fit with the screen width by placing the “
\” backslash at the end of each line to display the line break when wrapping the lines.
$ most -w article.txt
Remove the “\” Used to Display the Line Break
-d” flag can be used with the “
-w” flag to remove or hide the “
\” backslash that used to display the line break when wrapping the lines.
$ most -wd article.txt
I assume you can perform the rest of the flags and commands by watching them in the table section, so let’s move on to the removal part of this program.
Removing the “most” Command
If you do not want to use this tool anymore and are able to do most of your work using its alternative commands, then execute one of the following commands to remove it from your Linux system.
$ sudo apt remove most #On Debian and Ubuntu $ sudo dnf remove most #On Red Hat and Fedora $ sudo pacman -R most #On Arch and Manjaro
So, that was the last part of this article.
Mostly, I liked this tool for its window splitting feature, which made it more reliable when reading multiple files. The rest of the things you can easily find on its alternatives.
However, if you have any question or query that is not covered in this article, feel free to tell us in the comment section.
Join The Conversation
Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.