more 命令详解

阅读更多

Linux -- more 查看文件内容

 

NAME 名称

    more - file perusal filter for crt viewing

 

SYNOPSIS 语法

    more [options] file [...]

 

DESCRIPTION 说明

    more  is  a filter for paging through text one screenful at a time.  This version is especially primitive.  Users should realize that less(1) provides more(1) emulation plus extensive enhancements.

    more是一个一次显示一屏的翻阅文本的过滤器。这是一个特别原始的版本。用户应该了解一下less(1),他提供more(1)的基本功能但又丰富了其他功能。

 

OPTIONS 选项

    Command-line options are described below. Options are also taken from the environment variable MORE (make sure to precede them with a dash (``-'')) but command line options will override them.

    命令行选项详情如下。选项取决于MORE环境变量,但命令行选项也会覆盖MORE环境变量。

 

    -number

        This option specifies an integer number which is the screen size (in lines).

        此选项指定一个整数,用于指定屏幕大小,即一次显示的行数。

 

    -d

        more will prompt the user with the message "[Press space to continue, 'q' to  quit.]" and will display "[Press 'h' for instructions.]" instead of ringing the bell when an illegal key is pressed.

        more命令将会在底部提示用户"[Press space to continue, 'q' to quit.]" ,并且当键入一个非法值时,显示"[Press 'h' for instructions.]",而非鸣钟。

 

    -l

        more usually treats ^L (form feed) as a special character, and will  pause after any line that contains a form feed.  The -l option will prevent this behavior.

        more经常把^L作为特殊字符,当任意一行包含^L,将会暂停。-l选项会取消遇见特殊字符^L时会暂停的功能(试了下,没发现有啥用)。

 

    -f

        Causes more to count logical, rather than screen lines (i.e.,  long  lines are not folded).

        计算行数时,以实际上的行数,而非以换行后的行数。

 

    -p

        Do not scroll.  Instead, clear the whole screen and then display the text. Notice that this option is switched on automatically if the executable is named page.

        不显示滚动条。先清理屏幕,然后显示文本。

 

    -c

        Do not scroll. Instead, paint each screen from the top, clearing the remainder of each line as it is displayed.

        不显示滚动条。从命令窗口顶部显示,然后清理其余的文本。

 

    -s

        Squeeze multiple blank lines into one.

        当文件中有连续两行及以上空行时,只显示一行。

 

    -u

        Suppress underlining.

        不显示下引号(试了下,没发现有啥用)。

 

    +/

        The +/ option specifies a string that will be searched for before each file is displayed.

        +/选项后面指定一字符串,在每个文档显示之前搜所指定的字符串,然后从该字串之后开始显示。

 

    +number

        Start at line number.

        从第number行开始显示。

 

COMMANDS 命令

    Interactive commands for more are based on vi(1). Some commands may be preceded by a decimal number, called k in the descriptions below. In the following descriptions, ^X means control-X.

    more的交互命令是基于vi的。大多数命令前面都会跟一个十进制数,在下文中称之为k。在下文中^X的意思是Ctrl+X。

 

    h or ?

        Help:  display  a  summary of these commands.  If you forget all the other commands, remember this one.

        显示简易的命令信息。

 

    SPACE

        Display next k lines of text.  Defaults to current screen size.

        向下显示k行。默认为当前全屏大小。

 

    z

        Display next k lines of text. Defaults to current screen size. Argument becomes new default.

        向下显示k行。默认为当前全屏大小。参数成为新默认值。

 

    RETURN

        Display  next k lines of text.  Defaults to 1.  Argument becomes new default.

        向下显示k行。默认为当前全屏大小。参数成为新默认值。

 

    d or ^D

        Scroll k lines.  Default is current scroll size,  initially  11. Argument becomes new default.

        向下显示k行。默认为当前全屏大小的一半。参数成为新默认值。

 

    q or Q or INTERRUPT

        Exit.

        退出。

 

    s

        Skip forward k lines of text.  Defaults to 1.

        跳过下面k行,然后显示新的一屏,默认跳过1行。

 

    ^F

        Skip forward k lines of text.  Defaults to 1.

        跳过下面k行,然后显示新的一屏,默认跳过1行。

 

    f

        Skip forward k screenfuls of text.  Defaults to 1.

        跳过下面k屏,然后显示新的一屏,默认跳过1屏。

 

    b or ^B

        Skip backwards k screenfuls of text.  Defaults to 1.  Only works with files, not pipes.

        跳过上面k屏,然后显示新的一屏,默认跳过1屏。仅对文件有效,对管道符无效。

 

    '

        Go to place where previous search started.

        回到上次搜索的位置。

 

    =

        Display current line number.

        显示当前行的行号。

 

    /pattern

        Search for kth occurrence of regular expression.  Defaults to 1.

        往下搜索第k个满足正则表达式条件的结果的位置。默认往下搜索第1个。

 

    n

        Search for kth occurrence of last regular expression. Defaults to 1.

        往下搜索第k个满足上次正则表达式条件的结果的位置。默认往下搜索第1个。

 

    !command or :!command

        Execute command in a subshell.

        执行一个可执行的指令。

 

    v

        Start up an editor at current line. The editor is taken from the environment variable VISUAL if defined, or EDITOR if VISUAL is not defined, or defaults to vi if neither VISUAL nor EDITOR is defined.

        在当前行启用一个可编辑工具。

 

    ^L

        Redraw screen.

        重新生成下一屏。

 

    :n

        Go to kth next file.  Defaults to 1.

        跳转到在此后的第k个文件中,默认为1。

    :P

        Go to kth previous file.  Defaults to 1.

        跳转到在此前的第k个文件中,默认为1。

 

    :f

        Display current file name and line number.

        显示当前文件的名字及当前行号。

 

    .

        Repeat previous command.

        重新执行上一个指令。

 

ENVIRONMENT 环境

    More utilizes the following environment variables, if they exist:

        当以下环境变量指定时,more命令利用以下环境变量:

    MORE   This variable may be set with favored options to more.

        这个变量设置你喜欢的more选项。

    SHELL  Current shell in use (normally set by the shell at login time).

        当前使用的shell(一般说来就是登录shell)。

    TERM   Specifies terminal type, used by more to get the terminal characteristics necessary to manipulate the screen.

        指定 终端类型,more用它来获取操作屏幕所需的终端特性。

    VISUAL Editor the user is preferring.  Used when key command v is pressed.

    EDITOR Editor of choise when VISUAL is not specified.

 

SEE ALSO

    vi(1), less(1)

 

AUTHORS

    Eric Shienbrood, UC Berkeley

    Modified by Geoff Peck, UCB to add underlining, single spacing

    Modified by John Foderaro, UCB to add -c and MORE environment variable

 

HISTORY 历史

    The more command appeared in 3.0BSD. This man page documents more version 5.19 (Berkeley  6/29/88), which is currently in use in the Linux community. Documentation was produced using several other versions of the man page, and extensive inspection of the source code.

 

AVAILABILITY

    The more command is part of the util-linux package and is available from Linux Kernel Archive .

 

util-linux                  September 2011                 MORE(1)

 

案例分析:

一、原始文件

[root@user test]# ls test.txt

 

二、查看test.txt内容,多空行仅显示一行空行

[root@user test]# more -s test.txt

 

三、查看test.txt内容,从第10行显示

[root@user test]# more +20 test.txt

 

四、查看test.txt内容,显示‘String’所在位置

[root@user test]# more +/String test.txt

 

你可能感兴趣的:(more,linux,Unix,OS,查看文件)