Page by page display of long text file more command in CentOS


If you are used to working on a Linux system, you will surely find a large number of text files in the Linux world. Configuration and log files are usually in text format. These files usually have a long content and cannot be displayed in one screen. So when dealing with this kind of files, we need to display them in pages. Now we can use itmoreCommand.

What’s more for

More is a command used to display large text files in pages. It is built into each Linux distribution by default.

How to use more

With the more command, just type:

$ more file_name

For example, to check the log file syslog in the / var / log directory, just type:

$ more /var/log/syslog


And then we can seeThere is a prompt in the lower left corner of the screen, which tells us that the current display scale is 0%. It looks like this file is quite large, so the first page is 0% of the total number of pages. Use the space bar to scroll down the page, and then you can see that the percentage of prompts increases.

Scroll page

Limit the number of lines displayed per page

When executing the more command, it will occupy all the space of your terminal window for display. But you can use the parameters– DigitalTo limit the number of rows displayed per page.

For example, you want every pageLimit display to 12 lines, you can use the following command:

$ more -12 /var/log/syslog


Now, you will see that only 12 lines are displayed per page. After pressing the space bar, the next 12 lines will be displayed.

Display user message

As we know, the more command prompts the lower left corner of the display area for the percentage of the current content. For the first time using the more command, he or she may want to know how to turn down the page. To avoid this, we can add-dParameter, which will display an additional line of user information[Press the space bar to continue, ‘Q’ launch]”

More with -d option

If the user presses‘space’ or ‘Q‘Other buttons, more will display a line of help information“[press the ‘H’ key to see the prompt. ]

More displaying help message

If you press the H key, a help message is displayed:

Display help

An interesting instruction isbButton,B button allows youGo back to the previous page. In other words, the B button allowsFlip pages forward

You can go through theThe first 1 PagesMessage to confirm that the previous page is currently displayed.


No rolling

Pass parameters-c, the more command does not scroll the page, but directly clears the previous content and replaces it with the content of the next page. With-c option, more will not scroll the page. It will clear the previous page and put the next page or lines there.

$ more -10 -c lynis.log

Suppress scroll

If you press the space bar, the next page will still have the same size.

Suppress scroll

Ignore extra blank lines

Using parameters-sTo ignore the extra blank lines, here is an example:


When we add parameters-sLater:

$ more -s doc_30.txt


Find string

If your log file is very large, it’s not so easy to find the string you want. The find function of the more command can help you through the parameters+/stringIt can be used to search for strings, and the keywords found will be displayed in the first line. For example, we have to/var/logs/syslogSearch in file“dhclient”, the format of the more command:

$ more +/dhclient /var/log/syslog


Then, if you want to continue searching for the next one in the file, just press/ button, followed by the keyword dhclient.

Display from specified line

You can also use parameters+ numberFor example, we have a 15 line file:


Then we want to display the contents of this file from line 5. The command looks like this:

$ more +5 doc_30.txt


Can binaries be displayed?

The answer is noThe. More command prompts for information such as:



More is a basic tool for viewing text files. It cannot be used to display binary files. Usually, we can use the commandman moreperhapsmore –helpFor more information on how to use more.

Recommended Today

HelpHost.exe Process query helphost what is the role of the process

Process file: helphost or HelpHost.exeProcess name: Microsoft Help Center hosting serverProcess category: processes with security risks English Description:HelpHost.exe is a process associated with the Microsoft windows operating system. When help is requested in Windows 2000 or later version of Windows this process will be initiated. Chinese reference:HelpHost.exe It is a program related to Microsoft Windows […]