Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the more command under Linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Xiaobian to share with you how to use the more command under Linux, I believe most people do not know how to use it, so share this article for your reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!

When we work in a Linux environment, we definitely deal with all kinds of text files every day. These files, sometimes too long, cannot be displayed completely on one screen. So, when viewing such files, we need to display them in separate pages. At this point, we can use the more command.

Basic use

Suppose you now want to view a text file on the terminal. Just open a terminal, go to the corresponding directory, and enter the following command:

$ more

For example,

$ more jekyll-article.md

Use the space bar to scroll down, and enter q to exit.

If you want to search for some text in this file, type/and add the text you want to find after it. For example, if the field you want to view is "terminal," simply enter:

/terminal

Search content is case-sensitive, so typing/terminal and/Terminal will produce different results.

Combined with other utilities

You can pipe text from other command-line tools to more. You ask why? Because sometimes these tools get more text than a page of the terminal can display.

To do this, enter the full command you want to use, followed by the pipe symbol (|), followed by more. Suppose you have a directory with lots of files. You can combine more and ls commands to see the full contents of this directory.

$ ls | more

You can combine the more and grep commands to find the specified text in multiple files. Here's an example of how I looked for "productivity" in the source files of multiple articles.

$ grep ‘productivity’ core.md Dict.md lctt2014.md lctt2016.md lctt2018.md README.md | more

Another utility that can be combined with more is ps (list the processes running on your system). This combination comes in handy when you have a lot of processes running on your system and you want to view them now. For example, if you want to find a process that you want to kill, simply type the following command:

$ ps -u scott | more

Be careful to replace "scott" with your username.

As I mentioned at the beginning of this article, more is easy to use. Although not as nimble as its twin, less, it's still worth getting to know.

The above is "Linux more command how to use" all the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report