Skip to content

more command in Linux

The more command in Linux allows users to view the contents of large files page by page, facilitating easy navigation and search within the file. By displaying one screen of text at a time, more enables users to read through lengthy documents without overwhelming the terminal. With simple keyboard commands, users can move forward, backward, search for specific text, and quit the viewing process. This command provides a straightforward and efficient way to handle extensive text files in the Linux environment.

Terminal window
more [option] [file]
OptionDescription
-dDisplay more prompt
-fCount logical pages
-lIgnore form feeds
-pDo not scroll screen
-sSqueeze multiple blank lines
-uSuppress underlining
ParameterDescription
fileThe file to be viewed
Terminal window
more filename.txt

This command displays the contents of the “filename.txt” file page by page.

Terminal window
more -N filename.txt

The “-N” option displays line numbers when viewing the “filename.txt” file.

View content of multiple files in sequence

Section titled “View content of multiple files in sequence”
Terminal window
more file1.txt file2.txt

Displays the content of “file1.txt” followed by the content of “file2.txt” sequentially.

Terminal window
more filename.txt
/pattern

The “slash” followed by a search pattern allows you to search within the “filename.txt” while using more.

Terminal window
more -d filename.txt

Use the “-d” option to scroll up one line at a time when viewing the content of “filename.txt”.

Terminal window
more +10 filename.txt

Jumps directly to line 10 when viewing the content of “filename.txt”.

Terminal window
more +5 filename.txt

Skips the first 5 lines and starts displaying the content of “filename.txt” from the 6th line onwards.

Terminal window
more --help

Shows the help information for the more command, including available options and usage details.

To use the more command in Linux, execute the following command:

Terminal window
more --option <value>

What are some common options for the more command?

Section titled “What are some common options for the more command?”

Some common options for the more command in Linux include:

Terminal window
more -d file.txt

To scroll back while using the more command in Linux, press the b key.

How do I search for text within the more command?

Section titled “How do I search for text within the more command?”

You can search for text within the more command by typing a forward slash (/) followed by the text you want to search for. Press Enter to start the search and n to find the next occurrence.

To display line numbers while using the more command in Linux, you can use the following command:

Terminal window
more -n file.txt

How can I navigate to the beginning or end of a file with more?

Section titled “How can I navigate to the beginning or end of a file with more?”

To navigate to the beginning of a file with more, use the g command. To navigate to the end of a file, use the Shift+g command.

How do I use the more command to view multiple files?

Section titled “How do I use the more command to view multiple files?”

You can use the more command to view multiple files by providing the file names as arguments. For example:

Terminal window
more file1.txt file2.txt

Can I use the more command with pipes in Linux?

Section titled “Can I use the more command with pipes in Linux?”

Yes, you can use the more command with pipes in Linux to view the output of a command. For example:

Terminal window
ls -l | more

How do I exit the more command with a specific status?

Section titled “How do I exit the more command with a specific status?”

To exit the more command with a specific status, you can use the following key combination:

Terminal window
Ctrl + C
  • Viewing text files one screen at a time
  • Navigating through large files
  • Searching for specific strings within a file
  • Skipping through large sections of text
  • Pausing and resuming output in the terminal