more – Display the file contents, one screen at a time

The more command is used to display the contents of a file one screen at a time. It is often used to view the contents of large files or to quickly scan through the contents of a file.

Overview

The basic syntax for the more command is as follows:

more [options] [filename]

If you do not specify a filename, more will read from standard input. Once you have opened a file with more, you can navigate through the file using the following commands:

  • Spacebar: display the next screen of text
  • Enter: display the next line of text
  • q: quit the more command and return to the shell
  • /: search for a string of text within the file (type the string and press Enter)
  • n: display the next occurrence of the search string
  • !: execute a shell command (type the command and press Enter)

Examples

To display the contents of a file called example.txt, type the following command:

more example.txt

To search for the string “hello” within the file, type the following command:

more example.txt
/hello

To execute a shell command within more, type the following command:

more example.txt
!ls

Specific use cases

  • When viewing large log files, more can be used to quickly scan through the contents of the file to find specific information.
  • When working with long configuration files, more can be used to view the contents of the file without having to open it in a text editor.

Options

The following options are available for the more command:

Option Description
-d Display help screen
-f Count logical rather than screen lines
-l Suppress pause after form feed
-p Don’t scroll, display text with ^S and ^Q
-c Don’t scroll, display text with ^C
-s Squeeze multiple blank lines into one
-u Suppress underlining
-E Don’t display $ at end of lines
-n Number each line
-p Don’t scroll, display text with ^S and ^Q
-P Use specified pager

Troubleshooting tips

If you are having trouble using more, try the following:

  • Make sure you are using the correct syntax for the command.
  • If you are searching for a string within the file, make sure you are using the correct syntax for the search string.
  • If you are experiencing issues with the display of the file, try adjusting the options for more to see if that resolves the issue.

Notes

  • The more command is similar to the less command, which provides more advanced features and is often preferred by users.