How to use the Linux more command?

  
                

The more command under Linux is mainly used for split-screen display, that is, the file with more than one screen, which is a little different from the cat command. The following small series will give you a detailed introduction of the more command. If you are interested, you may wish to understand it.

more will be user-friendly display page by page-by-page reading, and basic instruction is to press the space bar (space) started for the next show, press b will go Back (back) one page display, but also the function of searching for strings. The more command reads the file from front to back, so the entire file is loaded at startup.

1. Command format:

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

2. Command function:

The more command and cat functions are the same as viewing the contents of the file, but the difference is that you can view the contents of the file by page, and also support direct jump lines and other functions.

3. Command parameters:

+n Display from 笫n line

-n Define screen size as n lines

+/pattern Search for this string before each file is displayed (pattern), then start after the first two lines of the string

-c clear the screen from the top, then display

-d prompt “Press space to continue,& rsquo;q’ To quit (press the space bar to continue, press the q key to exit) ”, disable the ring function

-l ignore the Ctrl+l (page change) character

-p by clearing the window instead of Scroll to page a page, similar to the -c option

-s Display multiple consecutive blank lines as one line

-u Remove the lower line in the file contents

4. Common operation commands:

Enter Down n lines, you need to define. The default is 1 line

Ctrl+F Scroll down one screen

Spacebar scrolls down one screen

Ctrl+B Back to previous screen

= Output the line number of the current line

:f Output file name and line number of the current line

V Call vi editor

! Command Call the shell and execute the command

q Exit more

5. Command Example:

Instance 1: Displaying Content from Line 3 in File

Command:

more +3 log2012.log

Output:

[root@localhost test]# cat log2012.log

2012-01

2012-02

2012-03

2012-04-day1

2012-04-day2

2012-04-day3

======[root@localhost test]# more +3 log2012 .log

2012-03

2012-04-day1

2012-04-day2

2012-04-day3

======[root@localhost test]#
Previous12Next page Total 2 pages

Copyright © Windows knowledge All Rights Reserved