What does linux more mean?

青灯夜游
Release: 2022-06-17 16:57:12
Original
8345 people have browsed it

In Linux, more means "more". It is a content split-screen command that can display the content of a large text file in pages, allowing users to read the content of the file page by page. It is built-in by default. In various Linux distributions, the syntax is "more [options] filename". The execution of the more command will open an interactive interface. Users can use interactive commands to view or edit content. For example, the enter key is used to move down one line, the space bar is used to move down one page, and "d" is used to move down. Half a page.

What does linux more mean?

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

linux more command

In Linux, more means "more" and is a content split-screen command.

The more command can display the contents of a large text file in pages, allowing users to read the contents of the file page by page. It is built into every Linux distribution by default.

The basic format of this command is as follows:

more [选项] 文件名
Copy after login

more The command is relatively simple and generally does not require any options. For the options listed in Table 1, users only need to see and recognize them. .

Table 1 more command options and meaning
          Options           Meaning
          -f             When calculating the number of lines, use the actual number of lines, not the number of lines after automatic line wrapping.
          -p             Instead of scrolling through each page, the screen is cleared first and then the content is displayed.
          -c             Similar to the -p option, except that the content is displayed first and other old data is cleared.
-s             When two or more consecutive blank lines are encountered, they are replaced with one blank line.
          -u             Do not display lower quotes (depending on the terminal specified by the environment variable TERM).
          n           Display the file contents starting from line n, where n represents a number.
          -n             The number of rows displayed at one time, n represents a number.

more The execution of the command will open an interactive interface, so readers need to understand some interactive commands. Commonly used interactive commands are shown in Table 2.

Table 2 more command interaction instructions and functions
            Interactive command           Function
h or ?             Display interactive command help for the more command.
          q or Q           Exit more.
          v           Start an editor on the current line.
          :f             Display the file name and line number of the current file.
          ! or :!           Execute the specified command in the subshell.
          Enter key Move down one line.
          space bar Move down one page.
          Ctrl l           Refresh the screen.
          =             Displays the line number of the current line.
          '           Go to where the last search started.
          Ctrf f           Scroll down one page.
          .             Repeat the last command entered.
          / String             Search for the specified string.
          d           Move down half a page.
          b           Move up one page.

more命令的使用

1、简单查看

想检查/var/log目录下的日志文件syslog,只需要键入:

$ more /var/log/syslog
Copy after login

What does linux more mean?

然后我们可以看到在屏幕左下角有个提示,告诉我们当前的显示比例为0%。看上去这个文件相当大,所以第一页是全部页数的0%。使用空格键可以往下翻页,然后就可以看到提示的百分比会增加。

What does linux more mean?

2、限制每页显示的行数

在执行more命令的时候,它会占用你终端窗口的全部空间用于显示。但是你可以通过参数-数字来限制每页显示的行数。

例如,你希望每页限制显示12行,可以通过下面的命令:

$ more -12 /var/log/syslog
Copy after login

What does linux more mean?

现在,你会看到每页只显示12行,在按下空格键后,就会翻页显示后面的12行。

3、显示用户提示

我们知道,more命令会在显示区域的左下角提示当前内容所占的百分比。对于第一次使用more命令的人来说,他或她可能会想知道怎么才能往下翻页。为了避免这种情况,我们可以在执行时增加-d参数,这样就会额外显示一行用户提示“[按空格键继续,‘q‘推出.]

What does linux more mean?

如果用户按了‘空格‘或’q‘之外的按键,more会显示一行帮助信息“ [按‘h’键查看提示。]

What does linux more mean?

如果按下h键,会显示一个帮助信息:

What does linux more mean?

一个有意思的指令是b按钮,b按钮允许你退回到前面的页面。换句话说,b按钮可以允许向前翻页。

你可以通过左上角的...前1页信息来确认当前显示的是前面的页面。

What does linux more mean?

4、从指定行开始显示

你也可以通过参数+数字来指定开始显示的行,例如,我们有一个15行的文件:

What does linux more mean?

然后我们想从第5行开始显示这个文件的内容,命令看起来会是这个样子:

$ more +5 doc_30.txt
Copy after login

What does linux more mean?

相关推荐:《Linux视频教程

The above is the detailed content of What does linux more mean?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template