Original article link
The more command is generally used to display files with more than one screen. Other commands often match more, but more commands are also used independently.
(1) Use other commands to match with the more command:
Format: other command formats | more
Example:
[Root @ redhat9/]Ls-Al | more% Ls when viewing the file list, there are too many files, but the display on one screen is incomplete. to display on one screen, you need to use more
(2) Use the more command separately:
Format:
More [Option] file or more [-dlfpcsu] [-num] [+/pattern] [+ linenum] [filenames...]
Parameters:
- -P: Clear the screen before displaying the next screen.
- -C works basically the same as-P. The difference is that the content is displayed before other old materials are cleared.
- -D displays more friendly prompts at the bottom of each screen:
- -- more -- (XX %) [Press space to contiune, 'q' to quit.]
- If you enter an incorrect command, the error message is displayed instead of a terminal.
- -l does not process Ctrl + L (page feed ). If this option is not provided, the more command displays
- A line containing Ctrl + L characters is paused and waiting for receiving the command.
- -s files are compressed into a blank row.
- -F indicates the actual number of rows when calculating the number of rows, the number of rows not after the automatic line feed (some rows with too long words will be extended to two or more rows)
- -U does not display quotation marks (terminal varies depending on the environment variable term)
- -number of rows per num
- +/search for the string (pattern) before each file is displayed, and then display it after the string
- + num displayed from row num
The number of files filenames want to display.
In addition:
During the execution of the more command, you can use the more command series to dynamically select the display part as needed. After a screen is displayed, more stops waiting for the user to enter a command. The following table lists some common commands used in the execution of more commands. You can view the complete content of these commands by H during the execution of more commands. The method for executing these commands is to first enter the value of I (number of rows) and then call the desired command, otherwise it will run the command with the default value. These commands are:
-
- If I is specified, the following I rows are displayed. Otherwise, the next screen is displayed.
-
- If I is specified, the I line below is displayed; otherwise, the next line is displayed.
-
- If I d is specified, the following I rows are displayed; otherwise, the half screen (usually 11 rows) is displayed ).
-
- I Ctrl + D with the same ID.
-
- I z is similar to "I space", but I will become the default number of rows for each full screen below.
-
- I s skips the line I below and then displays a full screen. The default value is 1.
-
- I f skips the I screen and then displays a whole screen. The default value is 1.
-
- I B skips back (that is, jumps back to the beginning of the file) I screen, and then displays a full screen. The default value is 1.
-
- I Ctrl + B is the same as "I B.
- 'Back to the last searched location
-
- Q or Q quit more.
-
- = Displays the current row number.
-
- V starts/usr/bin/VI in the current row to edit and modify it.
-
- H: displays the help information of each command.
-
- I/pattern: Find the line I that matches the pattern. The default value is 1.
-
- In searches for the reciprocal I rows that match the expression. The default value is 1.
-
- ! Or :! Execute commands in the sub-shell.
-
- I: N when multiple file names are specified in the command line, you can use this command to display the I-th file,
-
- If I is too large (exclusive), the last file in the file name list is displayed.
-
- If I: P specifies multiple file names in the command line, you can use this command to display the penultimate I file.
-
- If I is too large (exclusive), the first file is displayed.
- I: F displays the file name and number of lines of the current file.
-
- . Repeat the command of the last speaker.
Example:
More-s testfile% The content of the testfile file is displayed page by page. If there are two or more blank rows in a row, a blank row is displayed.
More + 20 testfile% The contents of the testfile file are displayed starting from row 20th.
More example1.c% Display the content of a file by page.
More-C-10 example1.c% After the command is executed, the screen is cleared first, and the content of the file example. C is displayed in every 10 lines and every 10 lines.