In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article is about the advanced use of the more command in Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
More command, function is similar to cat, cat command is the contents of the entire file is displayed from top to bottom on the screen. More will be a page-by-page display to facilitate users to read page by page, and the most basic instruction is to press the blank key (space) to display to the next page, press the b key to go back to (back) a page to display, and has the function of searching for strings.
Basic usage of more command
The more command is easy to use, as long as the text name is followed by more:
More file_name
For example, to view the / var/log/dmesg file, simply:
More / var/log/dmesg
The implementation result is shown below, which should be familiar to friends who have the foundation of Linux.
In the lower-left corner of the terminal, the percentage of the displayed text in the full text is displayed. If we want to see the contents of the next screen, just press the spacebar. After turning the page, we will also see a corresponding increase in the percentage in the lower left corner.
Common buttons:
Space bar: view the next screen; enter key: scroll down a line; b key: view a screen forward; Q key: exit.
These are the basic uses of the more command, which many friends should be familiar with. Next, Liangxu takes you step by step into the advanced usage of the more command.
Display starts with the specified line
When using the more command, the default is to start at the first line. But sometimes we may want to start with 100 lines directly, so how do we do that? In fact, you only need to add a + 100.
More + N file_name
For example:
More + 100 / var/log/dmesg
Limit the number of rows displayed per page
The more command is displayed full screen by default. What should we do if we only want to view a few lines at a time? Just add a-N option, where N is the number of rows you want to view.
More-N file_name
For example, for the / var/log/dmesg file, we only want to view 10 lines at a time, we can do this:
More-10 / var/log/dmesg
In this way, in the terminal, we can only see 10 lines at a time. Press the spacebar and we will continue to display the next 10 lines.
Display operation prompt information
If we want to display some prompts for the more command, we can add the-d option.
More-10-d / var/log/dmesg
We can see that in the bottom line, in addition to the percentage, additional prompts are displayed. If we randomly press a button that will not be recognized by the more command, it will prompt you to press the h key to view help.
Img
If we press the h button, it will display all the help information:
No scrolling
If we display 10 lines at a time, press the spacebar, and it will continue to display 10 lines down, like this:
This is the effect of pressing the spacebar once, and a total of 20 lines are displayed in the terminal, that is, it will keep scrolling down. What if we don't want to scroll like this and only look at 10 lines at a time? We just need to add the-c option.
More-10-c / var/log/dmesg
We have pressed the space twice, but only 10 lines are displayed in the terminal.
Thank you for reading! This is the end of this article on "what are the advanced uses of more commands in Linux?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
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.