Linux more command
The Linux more command is similar to cat, but displays content page by page, which is more convenient for users to read page by page. The most basic command is to press the space bar to display the next page, and press b to go back one page. It also has a string search function (similar to vi). For help while in use, press h.
Syntax
more [-dlfpcsu] [-num] [+/pattern] [+linenum] [fileNames..]
Parameters:
- -num The number of lines displayed at a time
- -d Prompt the user by displaying [Press space to continue, 'q' to quit.] at the bottom of the screen; if the user presses a wrong key, it will display [Press 'h' for instructions.] instead of a beep
- -l Cancel the function of pausing when encountering the special character ^L (form feed)
- -f When counting lines, use the actual number of lines rather than the number after automatic wrapping (some lines that are too long will be expanded into two or more lines)
- -p Instead of displaying each page by scrolling, clear the screen first and then display the content
- -c Similar to -p, except that it displays the content first and then clears other old data
- -s When encountering two or more consecutive blank lines, replace them with a single blank line
- -u Do not display underlines (varies depending on the terminal specified by the TERM environment variable)
- +/pattern Search for the string (pattern) before displaying each document, then start displaying from after that string
- +num Start displaying from line num
- fileNames The documents whose content is to be displayed; multiple files can be specified
Example
Display the content of the testfile document page by page; if there are two or more consecutive blank lines, display them as a single blank line.
more -s testfile
Display the content of the testfile document starting from line 20.
more +20 testfile
Common operation commands
- Enter Move down n lines, needs to be defined. Default is 1 line
- Ctrl+F Scroll down one screen
- Space bar Scroll down one screen
- Ctrl+B Return to the previous screen
- = Output the line number of the current line
- :f Output the file name and the line number of the current line
- V Invoke the vi editor
- !command Invoke the Shell and execute the command
- q Exit more
Linux Command Reference