A day linux commands: more (13)

more

The more command is based on the vi editor text filter, it displays the contents of a text file by pages in full screen, and supports keyword-targeted operation in vi. more built-in list of a number of shortcut keys, commonly used H (to get help), Enter (scroll down one line), space (scroll down a screen), Q (Exit command).

The command text one screen, the full screen to stop, and a message appears the percentage gives the document has been displayed at the bottom of the screen: - More - (XX%) by the following various methods can be to answer the prompt

  • Press Space: Displays the next screen content of the text.
  • Press the Enter key: only text contents of the next line.
  • Press slash |: then enter a mode, a search for the next match in the text mode.
  • Press H: Displays help screen, relevant help information on the screen.
  • Press B: content displayed on a screen.
  • Press Q: exit the more command.

format

more [options] [parameters]

Parameter options

parameter Remark
+n From the display start line Zi n
-n Screen size is defined as the n-th row
+/pattern The search string (pattern) before each file is displayed, and then began to show after the first two lines from the string
-c From the top of the screen is cleared, and then display
-d Prompt "Press space to continue, 'q' to quit (press the space bar to continue, press q to exit)" to disable the function ring
-l Ignore Ctrl + l (feed) character
-p To feed the file by clearing the window instead of scrolling, similar to the -c option
-s The plurality of consecutive blank lines appear on one line
-u To underline the file contents removed

Examples

  • Starting from a display file contents, line 2

    Command: More +2 myFile

[root@VM_0_9_centos ~]# cat myFile 
fuck my life 20191030
fuck my life2 
fuck my life3



fuck my life4
fuck my life5

[root@VM_0_9_centos ~]# more +2 myFile # 从第2行开始显示了
fuck my life2 
fuck my life3



fuck my life4
fuck my life5
  • Find a line "life4" string appears from the file, and start showing output from the first two lines there

    Instruction: More Tasu / Life4 MyFile

[root@VM_0_9_centos ~]# more +/life4 myFile

...skipping


fuck my life4
fuck my life5
  • Display file contents of the file, but before the first display screen is cleared, and complete nuclear displayed at the bottom of the screen percentage

Command: More -dc myFile

  • Display file contents of the file, once every two-line display, and clear the screen before displaying the first

Command: More -c -2 myFile

fuck my life 20191030
fuck my life2 
--More--(44%)
  • Set the number of lines per screen display

    Command: More -2 myFile

[root@VM_0_9_centos ~]# more -2 myFile 
fuck my life 20191030
fuck my life2 
--More--(44%)
  • Column a directory of files, since the content too much, we should learn to use more page display. This was and piping | combine

    Command: LS the -l | More -5

[root@VM_0_9_centos ~]# ls -l / | more -5
total 76
lrwxrwxrwx.  1 root root     7 Jun 11  2017 bin -> usr/bin
dr-xr-xr-x.  4 root root  4096 Apr 12  2018 boot
drwxr-xr-x   2 root root  4096 Apr 12  2018 data
drwxr-xr-x  19 root root  3000 Jul  6 01:39 dev
--More--

reference

Guess you like

Origin www.cnblogs.com/DiDi516/p/11778457.html