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

An article lets you learn the more commands in the Linux system.

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

There are many utilities in the Linux system that allow you to view text files in the terminal interface. One of them is more.

More is very similar to less, a tool I wrote about in my previous article. The main difference between them is that more only allows you to view files forward.

Although the functionality it can provide seems limited, it still has a lot of useful features to understand. Let's take a quick look at what more can do and how to use it.

Basic use

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

$more

For example,

$more jekyll-article.md

Use the spacebar to turn the page down and enter Q to exit.

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

/ terminal

The content of the search is case-sensitive, so typing / terminal and / Terminal will produce different results.

Used in combination with other utilities

You can pipe the text obtained by other command-line tools to more. You ask why you did it? Because sometimes the text obtained by these tools will exceed the limit that a page of the terminal can display.

To do this, type the complete command you want to use, followed by the pipe character (|), followed by more. Suppose you now have a directory with a lot of files. You can combine the 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 is an example of how I looked up "productivity" in the source files of several 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 will come in handy when there are 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 need to kill, simply enter the following Linux command:

Https://www.linuxcool.com/

$ps-u scott | more

Be careful to replace "scott" with your user name.

As I mentioned at the beginning of my article, more is easy to use. Although not as flexible as its twin brother less, it is still worth knowing.

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

Servers

Wechat

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

12
Report