If you are used to working on Linux, you will surely find a large number of text files in the Linux world. Configuration files and log files are generally in text format. These files usually have a long content and cannot be displayed on a single screen. Therefore, when processing such Linux commands
If you are used to working on Linux, you will surely find a large number of text files in the Linux world. Configuration files and log files are generally in text format. These files usually have a long content and cannot be displayed on a single screen. Therefore, when processing such files, we need to display them by page. In this case, we can use the more command.
What is more?
More is a command used to display large text files by page. it is built in various Linux releases by default.
How to use more
To use the more command, just type:
$ more file_name
For example, to check the syslog file in the/var/log directory, you only need to enter:
$ more /var/log/syslog
Then we can see a prompt in the lower left corner of the screen, telling us that the current display ratio is 0%. It seems that this file is quite large, so the first page is 0% of the total number of pages. You can use the space key to flip down the page and then you can see that the percentage of the prompt increases.
Limit the number of lines displayed per page
When executing the more command, it will occupy all the space in your terminal window for display. However, you can use the parameter-number to limit the number of lines displayed on each page.
For example, if you want to display up to 12 lines per page, run the following command:
$ more -12 /var/log/syslog
Now, you can see that only 12 rows are displayed on each page. after you press the space key, the next 12 rows are displayed on the page.
Display user message
As we know, the more command prompts the percentage of the current content in the lower left corner of the display area. For the first time using the more command, he or she may want to know how to flip the page. To avoid this problem, we can add the-d parameter during execution, which will display an additional line of user information "[press the space key to continue, 'Q' to launch.]"