“most” is an advanced alternative for the less command

Linux TLDR
Last Updated:
Reading time: 4 minutes

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.

Tutorial Details

DescriptionMost
Difficulty LevelLow
Root or Sudo PrivilegesNo
OS CompatibilityUbuntu, Manjaro, Fedora, etc.
Prerequisitesmost
Internet RequiredYes

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

Output:

Verifying the "most" program

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:

OptionsDescription
-bIt used to display files containing 8 bit characters.
-cForce to search the string with case-sensitivity.
-CRemove the color from the output.
-MDisable the use of MMAP files.
-sSqueeze multiple blank lines into one.
-uStrictly disable the support for UTF-8 mode.
+uForce to use UTF-8 mode (By default, it uses the current locate to determine.)
-wWrap the lines by placing a “\” backslash at the end of each line to break them.
-dRemove the “\” backslash that used to display the line break when wrapping the lines.
-zTurn off the gunzip-on-the-fly
+[N]Start at the specified line number.
+/[STRING]Start from the line containing the specified “[STRING]” string.

The following are known commands that will come into play while using this program:

CommandsAction
Down arrow, Ctrl+n, Enter, or VMove 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+rRedraw (or refresh) the window.
J, GPrompt for line number, then jump to that line.
%Prompt the percent number, then jump to that percent of the file.
h, Ctrl+hDisplay the help window.
f, /, or Ctrl+fPrompt 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.
nUse to move forward or backward based on the (f, /, or Ctrl+f) or “?“.
Ctrl+x 2, Ctrl+w 2Split the window in half.
Ctrl+x o, Ctrl+w oJump to another window.
Ctrl+x 0, Ctrl+w 0Delete the active window.
Ctrl+x 1, Ctrl+w 1Except active, delete all other windows.
E, eOpen the current file in your default editor.
:nMove to the next file (when multiple files are opened).
qQuit 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

Output:

Opening a single file using most command

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

Output:

Opening multiple files and moving between them using the "most" command

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.

Splitting the active window in half

Then use the “Ctrl+x o” or “Ctrl+w o” command to jump back and forth between each window.

Switch between the windows

If you have opened multiple files, then use the “:n” command to switch to the next file.

Switching between the multiple files on split windows

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.

Opening the file from a specific 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

Output:

Squeezing multiple blank lines into one

Wrapping the Lines

The “-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

Output:

Breaking the lines that do not fit with the screen width

Remove the “\” Used to Display the Line Break

The “-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

Output:

Removing the backslash used to display the line break

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.