The more command in Linux: pay file content

Introduction

In the day-to-day of a system manager or developer working in the terminal, it is common to find extensive text files: logs, configuration files, command output, etc. Reading all that content once can be overwhelming and inefficient. For this reason, Linux has several utilities designed to pay the output, allowing you to advance page by page and maintain control over the information shown. Among these tools, the more command is one of the most classic and simple to use.

What's more?

more is a filter that shows the content of one file or the standard output of another command on the screen, pausing after each full screen. It was created in the early years of Unix and is still present in virtually all modern Linux distributions. Its operation is very similar to that of less, but with less advanced functionalities; neveryourself, its simplicity makes it an ideal option when a quick paging is needed without overloading the memory.

Basic syntax

The simplest way to invoke more is:

more name _ of _ file

It can also be used with a pipe to pay the output of any command:

command | more

When running it, more shows the first screen of the content and expects the user to press the space bar to advance a full page, or the Enter key to advance line by line. Other useful keys are b to back a page (only in some versions) and q to leave immediately.

Most useful options

  • -n number: specifies the number of lines to be displayed on each screen. For example, more -20 files.
  • -d: causes more to show a help message on the bottom screen, indicating which keys are available (space, Enter, b, q, etc.). This is especially useful for new users.
  • -s: Compress multiple consecutive blank lines in one single, which can make the reading of files with many line leaps more comfortable.
  • + number: the display begins from the indicated line. For example, more + 50 files.txt omits the first 49 lines and starts showing from line 50.

Practical examples

Suppose we want to review the log file / var / log / syslog, which usually contains hundreds or thousands of lines. A typical command would be:

more / var / log / syslog

If we're only interested in the last 100 lines and want to see them paginadas, we can combine tail and more:

tail -n 200 / var / log / syslog | more

To view a long script and skip the first 30 comment lines, we use:

more + 30 script.sh

And if we want each screen to show exactly 15 lines, regardless of the size of the terminal, we run:

more -15 file _ largo.txt

Limitations and alternatives

Although more is useful and present in almost any system, it has some limitations. It does not allow to move back freely in all its versions (the b key may not work on certain systems), and lacks advanced search functions such as those offered less. When more interactivity is needed, such as looking for patterns with / or n, moving both forward and back with arrows, or leaving without losing position, less is usually the preferred option.

Another modern alternative is to use the combination of pg or even the padders themselves integrated into editors like vim or nano, but for simple and fast tasks, more remains a light choice and without dependencies.

Use tips

  • Always try the help key (-d) if you don't remember shortcuts.
  • Combine more with filter commands such as grep, awk or sort to reduce data volume before paying.
  • In scripts, avoid relying on more for interactive input; better use file redirection or use less if you need programme control.
  • Remember that more does not modify the file; it is just a display form.

Conclusion

The more command remains a valuable tool in the repertoire of any Linux user. Its simplicity, low resource consumption and universal availability make it ideal to quickly review text files or command output when advanced functionalities are not required. Knowing your options and knowing when to change to less or other alternatives will allow you to work more efficiently in the terminal.

This work is under aCreative Commons License Attribution 4.0 International for Francesc Roig francesc @ vivaldi.net.

EnglishenEnglishEnglish