Linux more command details

Source: Internet
Author: User

Linux more command details

When we use Linux/UNIX, we often need to view the file content or log. Normally, we will choose the cat command, but sometimes our file is too long to go beyond a screen, in this way, it is inconvenient to view the above information. Although we can press the shift key and then press pageup or pagedown to flip up and down pages, it is too troublesome! At this time, our more command will be ready.

The more command is similar to cat. The cat command displays the content of the entire file on the screen from top to bottom. More will display one page at a time to facilitate users to read one page at a time. The most basic instruction is to press the space key to display it on the next page, and press the B key to return (back) one page is displayed, and the string search function is also available.

1. Command Format:

More [-dlfpcsu] [-num] [+/pattern] [+ linenum] [file...]

2. command functions:

The more command and cat command have the same functions as viewing the content in the file, but the difference is that more can view the content of the file by PAGE, and support direct jump to the line and other functions.

3. command parameters:

+ N is displayed from rows n of bytes.

-N defines the screen size as n rows

+/Pattern Search for the string (pattern) before each file is displayed, and then the string is displayed after the first two lines.

-C clear the screen from the top and then display

-D: Press space to continue, 'q' to quit (Press the space key to continue, Press the q key to exit )."

-L ignore Ctrl + l (page feed) characters

-P clears the window instead of scrolling the screen to change the page of the file, similar to the-c option.

-S: displays multiple consecutive empty rows as one row.

-U remove the offline lines in the file content

4. Common operation commands:

Enter down n rows, which need to be defined. The default value is 1 line.

Ctrl + F scroll down one screen

Space key scroll down one screen

Ctrl + B return to the previous screen

= Output the row number of the current row

: F output file name and the row number of the current row

V call vi Editor

! Command to call Shell and execute the command

Q: Exit more.

Example: because there are too many files in a directory, we should learn to use more for paging display. This must be combined with pipelines |

Command:

Ls-l | more-5

[Test root@www.bkjia.com] # ls-l | more-5

Total 24

-Rw-r -- 1 root 308 12-01 16:49 log2012.log

-Rw-r -- 1 root 33 11-28 16:54 log2013.log

-Rw-r -- 1 root 127 10-28 16:51 log2014.log

Lrwxrwxrwx 1 root 7 10-28 log_link.log-> log. log

-Rw-r -- 1 root 25 10-28 17:02 log. log

-Rw-r -- 1 root 37 10-28 :07 log.txt

Drwxr-xr-x 6 root 4096 10-27 0scf

Drwxrwxrwx 2 root 4096 09-28 14:47 test3

Drwxrwxrwx 2 root 4096 10-28 test4

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.