Linux more Command

Linux 命令大全Linux Command Reference

The Linux more command is similar to cat, but displays content page by page, making it easier for users to read page by page. The most basic instruction is pressing the spacebar to go to the next page, pressing the b key to go back one page, and it also has a string search function (similar to vi). For instructions during use, press h.

Syntax

more [-dlfpcsu] [-num] [+/pattern] [+linenum] [fileNames..]

Parameters:

  • -num Number of lines to display at a time
  • -d Prompt the user, display [Press space to continue, 'q' to quit.] at the bottom of the screen. If the user presses the wrong key, display [Press 'h' for instructions.] instead of a beep.
  • -l Cancel the function that pauses when encountering the special character ^L (form feed character)
  • -f When counting lines, use the actual number of lines rather than the number after automatic line wrapping (some single-line text that is too long may be expanded into two or more lines)
  • -p Do not display each page by scrolling; instead, 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 there are more than two consecutive blank lines, replace them with one blank line
  • -u Do not display underlining (varies according to the terminal specified by the environment variable TERM)
  • +/pattern Search for the string (pattern) before each document is displayed, then start displaying from after that string
  • +num Start displaying from line num
  • fileNames The documents whose content is to be displayed; can be multiple

Examples

Display the content of the testfile document page by page. If there are more than two consecutive blank lines, display them as one blank line.

more -s testfile

Display the content of the testfile document starting from line 20.

more +20 testfile

Common Operation Commands

  • Enter Scroll down n lines, needs to be defined. Default is 1 line
  • Ctrl+F Scroll down one screen
  • Spacebar Scroll down one screen
  • Ctrl+B Go back 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 命令大全Linux Command Reference

Other Extensions