The more command, which functions like cat, the Cat command is the entire contents of the file displayed on the screen from top to bottom. More will be a page-by-page display to facilitate users to read pages, and the most basic instruction is to press the blank key (space) on the next page, press the B key will be back (back) a page, and there is the function of the search string, the more command from the previous read the file, so at the start of loading the entire file.
1. Command format:
more [-DLFPCSU] [-num] [+/pattern] [+ linenum] [file ...]
2. Command function:
The more commands and the cat function are the same view of the contents of the file, but the difference is that more can be viewed by the page to view the contents of the file, but also support the function of direct jump.
3. Command parameters:
+n starting from joys N rows
-N defines the screen size as n rows
+/pattern searches for the string before each file is displayed, and then starts from the first two lines of the string
-C clear the screen from the top and then display
-D hint "press space to continue, ' Q ' To quit (press SPACEBAR to continue, pressing Q key to exit)", disable the ringing function
-L ignores Ctrl+l (page break) characters
-p to page a file by clearing the window instead of scrolling, similar to the-C option
-S displays a contiguous number of empty rows as a row
-U Remove the line from the contents of the file
4. Common Operation Commands:
Enter down n rows, which need to be defined. Default is 1 rows
CTRL+F Scroll down one screen
Space bar scroll 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 to invoke the shell and execute the command
Q Exit More
5. Command instance:
Example 1: Display the contents of the file from line 3rd
Command:
More +3 Log2012.log
Output:
1 [email protected] test]# cat Log2012.log2 3 -- on4 5 -- Geneva6 7 --Geneva8 9 --Geneva-Day1Ten One --Geneva-Day2 A - --Geneva-Day3 - the - -======[[email protected] test]# more +3Log2012.log - + --Geneva - + --Geneva-Day1 A at --Geneva-Day2 - - --Geneva-Day3 - - - in======[[email protected] test]#
Example 2: Find the first line from a file with the "Day3" string, and start displaying the output from the first two lines there
Command:
1 More +/day3 Log2012.log
Output:
[Email protected] test]# More +/day3 log2012.log ...skipping -day2-day3 -- --======[[email protected] test]#
Example 3: Set the number of rows per screen
Command:
1 More-5 Log2012.log
Output:
1[Email protected] test]# more-5Log2012.log2 3 -- on4 5 -- Geneva6 7 --Geneva8 9 --Geneva-Day1Ten One --Geneva-day2
Example 4: Column A directory of files, because the content is too much, we should learn to use more to page display. This has to do with plumbing | Combined.
Command:
Ls-l | more-5
Output:
[Email protected] test]# Ls-l | More-5Total $-rw-r--r--1Root root308 One- on -: theLog2012.log-rw-r--r--1Root root - Ten- - -: WuLog2013.log-rw-r--r--1Root root127 Ten- - -:Wuyilog2014.loglrwxrwxrwx1Root root7 Ten- - the: -Log_link.logLog.log-rw-r--r--1Root root - Ten- - -: GenevaLog.log-rw-r--r--1Root rootPanax Notoginseng Ten- - -: -LOG.TXTDRWXR-xr-x6Root root4096 Ten- - on: -scfdrwxrwxrwx2Root root4096 Ten- - -: -test3drwxrwxrwx2Root root4096 Ten- - -: -Test4
Description
Each page shows 5 file information, press CTRL+F or SPACEBAR will display the next 5 file information.
Linux learning more commands