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 page flip commands more and less in Linux system

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly explains "how to use the page flip commands more and less in the Linux system". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to use the page flip commands more and less in the Linux system".

More

Filter for more- to read files on the monitor [[]]

Overview (SYNOPSIS)

More [- dlfpcsu] [- num] [+ / pattern] [+ linenum] [file...] [[]]

Description (DESCRIPTION)

More is a filter for paging and displaying text one screen at a time. This version is very basic. Users should know that less (1) provides a simulation of more (1) and enhances it. [[]]

Option (OPTION)

The command line options are described below. Options can be obtained from the environment variable MORE (make sure they start with a dash (``-), but command-line options can override them.

-num

This option specifies the number of rows on the screen (expressed as integers).

-d

Let more display the prompt message "[Press space to continue,'q' to quit.]" to the user, and when the user presses another key, it displays "[Press 'h' for instructions.]" instead of honking on the loudspeaker.

-l

More usually treats ^ L (form feed) as a special character and pauses when it encounters this character. The-l option prevents this feature.

-f

Make more count logical lines instead of screen lines (that is, long lines do not break to the next line).

-p

Instead of scrolling the screen, clear the entire screen and then display the text.

-c

Instead of scrolling, text is displayed from the top of each screen, and the rest of the line is cleared after each line is displayed.

S

Compress the repeated blank line into a blank line.

-u

Avoid underlining.

+ /

Before displaying each file, search for the text string specified by the + / option.

+ num

Start with the line number num.

[[]]

Command (COMMAND)

The interactive command of more is based on vi (1). Some commands begin with a decimal number, called k in the following description. In the later description, ^ X refers to control-X.

H or?

Help: displays a summary of these commands. If you forget all the other orders, please remember this.

SPACE

Displays the next k-line text. The default value is the current screen size.

Z

Displays the next k-line text. The default value is the current screen size. Parameter becomes the new default.

RETURN

Displays the next k-line text. The default value is 1. Parameter becomes the new default.

D or ^ D

Scroll the screen on k lines. The default value is the current scroll screen size, initialized to 11. Parameter becomes the new default.

Q or Q or INTERRUPT

Quit.

S

Skip the k-line text forward. The default value is 1.

F

Skip the k-screen text forward. The default value is 1.

B or ^ B

Jump back to the k-screen text. The default value is 1.

Skip to the place where the last search started.

=

Displays the current line number.

/ pattern

Search for the k th text string that matches the regular expression. The default value is 1.

N

Search for the last k text string that matches the regular expression. The default value is 1.

! Or:!

Execute in the child shell.

V

Start / usr/bin/vi and point to the current line.

^ L

Refresh the screen.

: n

Skip to the next k file. The default value is 1.

: p

Skip to the previous k file. The default value is 1.

: f

Displays the current file name and line number.

.

Repeat the last command.

[[]]

Environment (ENVIRONMENT)

More makes use of the following environment variables, if they exist:

MORE

This variable sets your favorite more option.

SHELL

The shell currently in use (generally speaking, login to shell).

TERM

Specifies the terminal type that more uses to obtain the terminal features required to operate the screen

Example:

The code is as follows:

[root@localhost zhangy] # more test.php # View files

[root@localhost zhangy] # netstat-tpnl | more # commonly used, paged display

Less

Less is similar to the more command, but you can view the contents of the upper and lower pages through the page flip key.

-b sets the size of the buffer

-e automatically leave when the file is displayed

-f force the opening of special files, such as peripheral codes, directories, and binaries

-g marks only the last keyword searched

-I ignore the case of the search

-m displays the percentage similar to the more command

-N displays the line number of each line

-o Save the less output in the specified file

-Q does not use warning tones

-s displays a row of continuous empty behavior

-S line will be discarded if it takes too long

-x displays the "tab" key as a specified number space

Internal operation of command

The button functions are as follows:

B turn back one page

D turn back half a page

H displays the help interface

Q exits the less command

U scroll forward half a page

Y scroll forward one line

The spacebar scrolls one line

Press enter to scroll one page

1) search forward

/: use a pattern to search and navigate to the next matching text

N: find the next matching text forward

N: find the previous matching text backwards

2) search backward

Use the pattern to search and navigate to the previous matching text

N: look back for the next matching text

N: find the previous matching text forward

2 full-screen navigation

Ctrl + F: move forward one screen

Ctrl + B: move one screen backwards

Ctrl + D: move half the screen forward

Ctrl + U: move half the screen backward

3 one-way navigation

J: move one line forward

K: move one line backward

4 other navigation

G: move to the last line

G: move to the first line

Q / ZZ: exit the less command

5 Editing the file

V: enter edit mode and edit the current file using the configured editor

6 mark navigation

When you use less to view large files, you can mark them anywhere, and you can navigate to a text location marked with a specific tag through the command.

Ma: use a to mark the current position of the text

'a: navigate to mark a

7 browse multiple files

In the first way, you can browse multiple files by passing multiple parameters to less.

Less file1 file2

Second, when browsing a file, use: e to open another file.

Less file1

: e file2

When opening multiple files, use the following command to switch between multiple files

: n-browse the next file

: P-browse the previous file

Example:

The code is as follows:

[root@localhost zhangy] # less test.php # View files

[root@localhost zhangy] # netstat-tpnl | less # commonly used, paged display

Thank you for reading, the above is the content of "how to use the page flip commands more and less in the Linux system". After the study of this article, I believe you have a deeper understanding of how to use the page flip commands more and less in the Linux system, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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