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 to view text files under Linux

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

Share

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

This article mainly introduces the Linux how to use the more command to view the text file related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that everyone read this Linux how to use the more command to view the text file article will have a harvest, let's take a look.

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.

$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 command:

$ps-u scott | more

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

This is the end of the article on "how to use the more command to view text files under Linux". Thank you for reading! I believe that everyone has a certain understanding of "how to use the more command to view text files under Linux". If you want to learn more, you are welcome to follow 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