Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

more - display files on a page-by-page basis

&pagelevel(4)&pagelevel

The more command is used to page through the contents of one or more files on the terminal.

more displays its output by scrolling up lines on the screen.


Syntax


Format 1:more[ -cdefisu][ -n number][ -p command][ file]...
Format 2:more[ -cdefisu][ -n number][ +command][ -lines]
    [ +line_number][ +/pattern][ file]...

No option specified

The output is displayed one screenful at a time by default and can be controlled further with the commands described below. If you do not specify any of the options or built-in commands, more pauses after each screenful.

After the first screenful, (<filename>..%) appears as a prompt at the bottom of the screen.

If you press the space bar (on block-mode terminals space bar and DUE), more displays another screenful. If you press only the enter key (resp. DUE), the screen is scrolled one more line down.

more provides a two-line overlap between screens for continuity. If more is reading input from a file, the percentage of lines displayed so far is also shown (..%). This does not occur when more is used in combination with a pipe (|).

-c

more clears the screen before displaying a new page; useful on faster displays. The -c option is ignored if the terminal does not have the ability to clear the screen.

-d

On block terminals, comments and warnings referring to unavailable screen control facilities are suppressed.

-e

Causes more to automatically exit the file the first time it reaches the end of the file. By default, more exits when it reaches the end of the file for the second time.

-f

more does not fold long lines that extend beyond the right edge of the screen. The -f option cannot prevent line breaks automatically generated by the terminal hardware. more continues to count the displayed lines as if no line breaks have occurred.

-i

Case is ignored during a search, i.e. lowercase and uppercase are regarded as the same. A search can also be conducted for overscored or underscored text. This option is ignored if the search pattern itself contains uppercase letters.

-s

more compresses the output file by replacing multiple blanks with a single blank.

-u

more suppresses generation of underlining escape sequences.

-u not specified:
more handles underlining produced by text formatters such as nroff in a manner appropriate to the terminal. If the terminal can do underlining or has a stand-out mode, more supplies appropriate escape sequences as called for in the text file.

-n number

Specify the number of lines per screenful. The number argument is a positive decimal integer.

-p command

The -p option in the command line is the same as specifying +/ command, i.e. more executes command each time at new file is displayed.

This is the same as the + command that is also supported.

-lines

The value which you specify for lines defines the number of lines in each screenful.

+line_number

more starts output of the file at the given line_number.

+/pattern

pattern is a regular expression which may be used to browse through a text file. The output begins two lines above the string which matches pattern.
Unlike patterns used with editors, this construct should not end with a / (slash). If it does, the trailing slash will be interpreted as a character in the search pattern.

file

Name of the file or files to be displayed. If multiple files are given, the name of the current file is displayed in a header line before each file.

Commands

When more pauses at the end of a screenful, you can control subsequent output with the following commands:

n<space_bar>

more displays n more lines. If you press the space bar (on block-mode terminals space bar and DUE) without a value for n, the next screenful is displayed.

n<enter>

more displays n more lines. If you press the enter key without a value for n, the next line is displayed.

n<CTRL+D>
nd

more displays n more lines and sets the scroll size to n.

nz

more sets the number of lines per screenful to n and displays the next screenful.

ns

more skips n lines of output and prints the text that follows. The omission is indicated by a comment at the skipped position.

nf

The number you specify for n defines how many screenfuls are to be skipped. The number of lines omitted as a result is indicated at the skipped position.

n<CTRL+B>
nb

more skips back n screenfuls.

q
Q
:q
:Q

The above four forms of Q terminate more.

=

more displays the current line number.

v

more calls the vi editor and skips to the current line of the current file. The current line is the last line displayed by more.

h

more displays a tabular overview of all more commands with a brief description of their functions.

n/pattern

more searches forward for the nth occurrence of the regular expression pattern. If the given pattern occurs fewer than n times and if more is reading from a file rather than a pipe, the position in the file remains unchanged. If more is reading from a pipe, it will terminate.

If the search succeeds, more displays a new screenful starting two lines before the line containing the nth match.

/n

more searches for the nth occurrence of the last regular expression entered.

' (single quote)

more goes to the point from which the last search for a regular expression was started. All subsequent single quotes are ignored. If no search has been performed yet, more goes to the start of the file.

!command

more invokes a new shell to execute the specified shell_command. Two additional variables may be used when defining command:

% is expanded to the current file name;

! is expanded to the previous shell command.

If you need to include a % or ! in the command, you must escape it by preceding it with a backslash.

n:n

more skips forward to the nth next file named in the command line. If fewer than n files are listed, more skips to the last file; without a value for n, it skips to the next file in the given order. If you are already in the last file, more terminates.

n:p

more skips back to the nth previous file named in the command line. If fewer than n files are listed, more skips to the first file.

This command will not work if more is reading from a pipe.

:f

more displays the current file name and line number.

. (dot)

more repeats the previous command.

Functionality

The more command set the terminal to noecho mode. In other words, more’s built-in commands are not displayed on your terminal when you enter them, except for regular expressions, the exclamation point, and the slash.

more operates in cbreak mode, which means that the commands listed above are processed as soon as they are completed and need not be confirmed with the enter key. This mode also causes both commands to automatically terminate at the end of the text file.

Since more is generally more efficient at skipping forward than back, it is not very suitable for performing reverse searches on large files.

more discovers the terminal’s display characteristics by reading the terminfo files.

File

/usr/share/lib/terminfo/*

File containing display characteristics.

/usr/lib/more.hlp

Help file

Variable

COLUMNS

Override the system selected horizontal screen size.

EDITOR

Used by the v command to select an editor.

LINES

Override the system selected vertical screen size. The -n option takes precedence over the LINES variable for determining the number of lines in a screenful.

Locale

The following environment variables affect the execution of more:

LANG

Provide a default value for the internationalization variables that are unset or null. If LANG is unset of null, the corresponding value from the implementation-specific default locale will be used. If any of the internationalization variables contains an invalid setting, the utility will behave as if none of the variables had been defined.

LC_ALL

If set to a non-empty string value, override the values of all the other internationalization variables.

LC_COLLATE

Determine the locale for the behavior of ranges, equivalence classes and multicharacter collating elements within regular expressions.

LC_CTYPE

Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments and input files) and the behavior of character classes within regular expressions.

LC_MESSAGES

Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.

NLSPATH

Determine the location of message catalogs for the processing of LC_MESSAGES.

Example

Displaying the file named test, starting at the location of the word example and without folding long lines:

$ more -f +/example test <enter>

The output begins two lines above the first line which contains the word example.

See also

cat, ed, man, sh