Everything You Need to Know About the 'More' Command

Turn a long-scroll list into handy pages within the terminal

The More utility in the Linux shell accepts input from some other command, then arranges the output in a series of pages within the terminal window. This program precludes the need to scroll long lists of output.

It's a standard part of any Linux installation regardless of your distribution.

It's a simpler variant of the Less utility.

Using the 'More' Utility

The More command has been standard in Linux since the early days of BSD; versions of it date to 1988. More runs in two modes: First as a command-line utility, and second as an interactive program.

To invoke More from the terminal, use the following syntax:

$more [options] file

Alternatively, pipe the output of a command to More. For example, an extended process listing using the Ps command generally runs several pages; to paginate the output using More, pipe the output as follows:

$ps -ax | more
A terminal window with the PS command piped to the More command.

Options for the 'More' Command

More supports several optional switches, including:

  • -d: Offers help information when invalid keys are pressed during interactive mode
  • -l: Skip pauses after lines containing a form-feed character
  • -f: Count logical, rather than screen, lines (e.g., don't wrap long lines)
  • -p: Skip scrolling and instead clear the screen before displaying the next page
  • -s: Condense several blank lines into one
  • -number: Stipulate the number of screen lines to display for each page
  • +number: Display the file starting at the specified line number
  • +/string: Search for string and begin displaying the file at that point
  • --help: Displays the utility's help text, then exists

Using 'More' Interactively

When More is currently in the terminal foreground, it supports several commands patterned on the Vi editor. Common commands include:

  • h: Displays help text
  • space: Displays the next page of text (by default, the current screen size)
  • z: Displays next X lines of text — by default, the current screen size, but if you type a number and then press z, it'll advance by that many lines and then change the default
  • q: Exit
  • s: Skip forward X lines of text (precede with a number, otherwise defaults to 1)
  • f: Skip forward X screenfuls of text (precede with a number, otherwise defaults to 1)
  • b: Skip backward X screenfuls of text (precede with a number, otherwise defaults to 1) — this command cannot, however, be used when you've piped a command into More
  • =: Displays the current line number
  • /pattern: Searches for an occurrence of a regular expression rendered between double-quote marks; if you specify a number before the /pattern string, it'll find the Xth occurrence of that string
  • n: Searches for the next occurrence of the pattern
  • v: Starts an editor (by default, Vi) at the current line

Example Usage

To display the contents of a sample file beginning at line 1500:

$more +1500 sample.txt

To display the first occurrence of the phrase Linux rocks! from a sample file:

$more +/"Linux rocks!" sample.txt

Environment Variables

More respects environment variables. To set standard settings (e.g., standard number of lines or pages to skip), use the MORE variable. To specify a specific editor, use the VISUAL variable. Consult the manpage for More for precise guidance.