More commands, functions like cat, Cat command is the contents of the entire file from top to bottom displayed on the screen. More will be a page of the display to facilitate users read-by-page, and the most basic instructions is to press the blank key (space) on the next page to display, press the B key will return (back) a page, but also search the function of the string. The more command reads the file backwards from the front, so it loads the entire file at startup.
1. Command format:
more [-DLFPCSU] [-num] [+/pattern] [+ linenum] [file ...]
2. Command function:
More commands and Cat's function is to view the contents of the file, but the difference is more can be viewed by page to view the contents of the file, but also support the direct jump switch and other functions.
3. Command parameters:
+n starting from joys N rows
-N defines a screen size of n rows
+/pattern searches for the string (pattern) before each file is displayed, and then starts after the first two lines of the string
-C clear the screen from the top, and then display
-D prompt "Press space to continue, ' Q ' To quit (click Spacebar to continue, press Q to exit)", disable ring function
-L ignores ctrl+l (page change) characters
-p to change the page by clearing the window instead of scrolling, similar to the-C option
-S to display consecutive multiple blank lines as one row
-U Remove the bottom line from the contents of the file
4. Common Operation Commands:
Enter the down n line, which you want to define. Default is 1 lines
CTRL+F Scroll down one screen
Space bar scroll down one screen
Ctrl+b return to the previous screen
= Output the line number of the current line
: F output File name and line number of current line
V Call VI Editor
! Command calls the shell and executes commands
Q Quit more
5. Command instance:
Example 1: Displays content from line 3rd in a 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]#
Instance 2: Finds the first line in the file that appears with the "Day3" string, and starts showing the output from the first two lines
Command
More +/day3 Log2012.log
Output:
[Root@localhost test]# more +/day3 Log2012.log
... skipping
2012-04-day1
2012-04-day2
2012-04-day3
2012-05
2012-05-day1
======[root@localhost test]#
Example 3: Set the number of rows per screen
Command:
More-5 Log2012.log
Output:
[Root@localhost test]# more-5 Log2012.log
2012-01
2012-02
2012-03
2012-04-day1
2012-04-day2
Description
As shown in the following figure, the bottom of the screen shows the content of the total number of files in the proportion, press ctrl+f or the space bar will display the next screen 5 content, the percentage will also follow the changes.
Example 4: Column A directory of files, because the content is too much, we should learn to use more to pagination display. This has to do with plumbing | Combined
Command:
Ls-l | More-5
Output:
[Root@localhost test]# ls-l | More-5
Total 36
-rw-r--r--1 root root 308 11-01 16:49 Log2012.log
-rw-r--r--1 root 10-28 16:54 log2013.log
-rw-r--r--1 root root 127 10-28 16:51 Log2014.log
lrwxrwxrwx 1 root 7 10-28 15:18 log_link.log-> log.log
-rw-r--r--1 root 10-28 17:02 log.log
-rw-r--r--1 root radix 10-28 17:07 log.txt
Drwxr-xr-x 6 root root 4096 10-27 01:58 SCF
DRWXRWXRWX 2 root root 4096 10-28 14:47 test3
DRWXRWXRWX 2 root root 4096 10-28 14:47 test4
Description
Display 5 file information per page, press Ctrl+f or space bar will display the next 5 file information
View a full set of articles: Http://www.bianceng.cn/OS/Linux/201301/35075.htm