more command instructions

1, Command Overview

The more command of the contents of a text file longer content (not in a complete-screen display) screen output, and supports positioned keywords in the display. As for the content of text file contents less is recommended cat command.

2, the command syntax

more [options] [file] 

3, command options

-num specified for each screen display num lines

+ Num num began to show from the first row

+ / Pattern to search for the word (pattern) is displayed in front of each document, and then began to show after the first two lines from the string

-L will pause function canceled meet the special characters ^ L (feed characters)

-f calculate the actual number of rows, the number of lines rather than wrap (some words long single line will be extended to more than two lines or two lines)

-p to clear the screen then displays the remaining contents of text files

-c and -p similar, no scrolling, and then displays the contents of the first clear out old content

-s plurality of blank lines into one line display

-u does not show underscore

-d prompt "Press space to continue, 'q' to quit (press the space bar to continue, press q to exit)" to disable the function ring

Internal command operations:

    Space key: displaying text next screen
    Enter: n rows down, needs to be defined, the default is one line
    q key: Exit the more command
    Ctrl + f: scroll down a screen
    Ctrl + b: return to the previous screen
    =: output current line number
    : f: current output file name and line number
    v: invokes the vi editor
    :! call Shell, and execute command
    h: displays help screen

4, an example of command

4.1 -num specified for each screen display num lines, more -10 / etc / ssh / sshd_config screen display 10 rows per

 1 [root@localhost ~]# more -10 /etc/ssh/sshd_config
 2 #    $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $
 3 
 4 # This is the sshd server system-wide configuration file.  See
 5 # sshd_config(5) for more information.
 6 
 7 # This sshd was compiled with PATH=/usr/local/bin:/usr/bin
 8 
 9 # The strategy used for options in the default sshd_config shipped with
10 # OpenSSH is to specify options with their default value where
11 # possible, but leave them commented.  Uncommented options override the
12 --More--(11%)

4.2 + num num line is displayed from the first, more + 10 / etc / ssh / sshd_config is displayed from the line 10

4.3 + / pattern to search for the word (pattern) is displayed in front of each document, and then began to show after the string from; more + / Port / etc / ssh / sshd_config is displayed from the first two lines of characters included Port

 1 [root@localhost ~]# more +/Port /etc/ssh/sshd_config
 2 
 3 ...跳过
 4 # semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
 5 #
 6 Port 28256
 7 #AddressFamily any
 8 #ListenAddress 0.0.0.0
 9 #ListenAddress ::
10 
11 HostKey /etc/ssh/ssh_host_rsa_key
12 #HostKey /etc/ssh/ssh_host_dsa_key
13 HostKey /etc/ssh/ssh_host_ecdsa_key
14 HostKey /etc/ssh/ssh_host_ed25519_key
15 
16 # Ciphers and keying
17 #RekeyLimit default none

4.4 Find the first line from the file "abc" string appears and starts from the front row two lines to the last line of output as a new file

1 [root@localhost ~]# more +/abc work.txt > work1.txt

Guess you like

Origin www.cnblogs.com/liuzgg/p/11654027.html