In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "the usage of more command in linux". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the usage of the more command in linux.
1. Command format:
More [- dlfpcsu] [- num] [+ / pattern] [+ linenum] [file...]
2. Command function:
The more command is the same as cat's function is to view the contents of the file, but the difference is that more can view the contents of the file by page, but also supports direct jump line and other functions.
3. Command parameters:
+ n starts with line n.
-n defines the screen size as n lines
+ / pattern searches for the string (pattern) before each file is displayed, and then displays it after the first two lines of the string
-c clear the screen from the top and display
-d prompt "Press space to continue,'q' to quit (press Spacebar to continue, press Q key to exit)" to disable the ringing function
-l ignores Ctrl+l (page feed) characters
-p page the file by clearing the window instead of scrolling, similar to the-c option
-s displays consecutive blank lines as one line
-u remove the underline from the contents of the file
4. Common operation commands:
Enter goes down n lines and needs to be defined. The default is 1 line
Ctrl+F scrolls down one screen
The space bar scrolls down one screen
Ctrl+B returns to the previous screen
= output the line number of the current line
: F output file name and line number of the current line
V calls the vi editor
! Command invokes Shell and executes the command
Q exit more
5. Command example:
Example 1: displays the contents of the file starting from line 3
Command:
More + 3 log2012.log
Output:
The code is as follows:
[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] #
Example 2: find the first line where the "day3" string appears in the file, and display the output from the first two lines there
Command:
More + / day3 log2012.log
Output:
The code is as follows:
[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 displayed per screen
Command:
More-5 log2012.log
Output:
The code is as follows:
[root@localhost test] # more-5 log2012.log
2012-01
2012-02
2012-03
2012-04-day1
2012-04-day2
Description:
The bottom shows the proportion of the content displayed on this screen to the total number of lines of the file. Pressing Ctrl+F or the Spacebar will display 5 items on the next screen, and the percentage will change accordingly.
Example 4: list the files under a directory, because there are too many contents, we should learn to use more to page display. This has to be combined with plumbing |
Command:
Ls-l | more-5
Output:
The code is as follows:
[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 root 33 10-28 16:54 log2013.log
-rw-r--r-- 1 root root 127 10-28 16:51 log2014.log
Lrwxrwxrwx 1 root root 7 10-28 15:18 log_link.log-> log.log
-rw-r--r-- 1 root root 25 10-28 17:02 log.log
-rw-r--r-- 1 root root 37 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:
Each page displays 5 file information, press Ctrl+F or the spacebar will display the next 5 file information.
At this point, I believe you have a deeper understanding of "the use of the more command in linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.