The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

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

 SYNOPSIS



more [-ceisu][-n number][-p command][-t tagstring][file...]

more [-ceisu][-n number][+command][-t tagstring][file...]

 DESCRIPTION

The more utility reads files and either writes them to the terminal on a page-by-page basis or filters them to standard output. If standard output is not a terminal device, all input files are copied to standard output in their entirety, without modification. If standard output is a terminal device, the files will be written a number of lines (one screenful) at a time under the control of user commands; see the EXTENDED DESCRIPTION section.

Certain block-mode terminals do not have all the capabilities necessary to support the complete more definition; they are incapable of accepting commands that are not terminated with a newline character. Implementations that support such terminals provide an operating mode to more in which all commands can be terminated with a newline character on those terminals. This mode will:

 OPTIONS

The more utility supports the XBD specification, Utility Syntax Guidelines  , except that +command of the obsolescent version uses a non-standard syntax.

The following options are supported:

-c
If a screen is to be written that has no lines in common with the current screen, or more is writing its first screen, more will not scroll the screen, but instead will redraw each line of the screen in turn, from the top of the screen to the bottom. In addition, if more is writing its first screen, the screen will be cleared. This option may be ignored on devices that do not have the ability to clear to the end of a line or the end of a screen.
-e
Exit immediately after writing the last line of the last file in the argument list; see the EXTENDED DESCRIPTION section.
-i
Perform pattern matching in searches without regard to case. See the XBD specification, Regular Expression General Requirements  .
-n number
Specify the number of lines per screenful. The number argument is a positive decimal integer. The -n option overrides any values obtained from the environment.
-p command
+command
For each file examined, initially execute the more command in the command argument. If the command is a positioning command, such as a line number or a regular expression search, set the current position (see the EXTENDED DESCRIPTION section) to represent the final results of the command, without writing any intermediate lines of the file. For example, the two commands:

more -p 1000j file
more -p 1000G file

would be equivalent and start the display with the current position at line 1000, bypassing the lines that j would write and scroll off the screen if it had been issued during the file examination. If the positioning command is unsuccessful, the first line in the file will be the current position.
-s
Replace consecutive empty lines with a single empty line.
-t tagstring
Write the screenful of the file containing the tag named by the tagstring argument. See the ctags utility. The tags feature represented by -t tagstring and the :t command is optional. It is provided on any system that also provides a conforming implementation of ctags; otherwise, the use of -t produces undefined results.
-u
Treat a backspace character as a printable control character, displayed as an implementation-dependent character sequence (see the EXTENDED DESCRIPTION section), suppressing backspacing and the special handling that produces underlined or standout-mode text on some terminal types. Also, do not ignore a carriage-return character at the end of a line.

If both the -t tagstring and -p command (or the obsolescent +command) options are given, the -t tagstring will be processed first; that is, the file containing the tag is selected by -t and then the command is executed.

 OPERANDS

The following operand is supported:
file
A pathname of an input file. If no file operands are specified, the standard input will be used. If a file is "-", the standard input will be read at that point in the sequence.

 STDIN

The standard input will be used only if no file operands are specified, or if a file operand is "-".

 INPUT FILES

The input files being examined must be text files. If standard output is a terminal, standard error will be used to read commands from the user. If standard output is a terminal, standard error is not readable, and command input is needed, more will terminate with an error indicating that it was unable to read user commands. If standard output is not a terminal, no error will result if standard error cannot be opened for reading.

 ENVIRONMENT VARIABLES

The following environment variables affect the execution of more:
COLUMNS
Override the system-selected horizontal screen size. See the XBD specification, Environment Variables  for valid values and results when it is unset or null.
EDITOR
Used by the v command to select an editor; see the EXTENDED DESCRIPTION section.
LANG
Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation 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 internationalisation variables.
LC_COLLATE
Determine the locale for the behaviour of ranges, equivalence classes and multi-character 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 behaviour 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 and informative messages written to standard output.
NLSPATH
Determine the location of message catalogues for the processing of LC_MESSAGES .
LINES
Override the system-selected vertical screen size, used as the number of lines in a screenful. See the XBD specification, Environment Variables  for valid values and results when it is unset or null. The -n option takes precedence over the LINES variable for determining the number of lines in a screenful.
MORE
Determine a string containing options described in the OPTIONS section preceded with hyphens and blank-character-separated as on the command line. Any command-line options are processed after those in the MORE variable, as if the command line were:

more $MORE options operands

The MORE variable takes precedence over the TERM and LINES variables for determining the number of lines in a screenful.
TERM
Determine the name of the terminal type. If this variable is unset or null, an unspecified default terminal type will be used.

 ASYNCHRONOUS EVENTS

Default.

 STDOUT

The standard output will be used to write the contents of the input files.

 STDERR

Used for diagnostic messages and user commands (see the INPUT FILES section), and, if standard output is a terminal device, to write a prompting string. The prompting string will only appear as the last line of the screen and will contain the name of the file currently being examined, but it is otherwise unspecified. User input for the /, ?, :e and :t commands will be written on the same line of the screen as the prompt. It is unspecified if informational messages are written for other user commands.

 OUTPUT FILES

None.

 EXTENDED DESCRIPTION

The number of lines available per screen is determined by the -n option, if present or by examining values in the environment (see the ENVIRONMENT VARIABLES section). If neither method yields a number, an unspecified number of lines will be used. The actual number of lines written will be one less than this number, as the last line of the screen will be used to write a user prompt and user input. If the number of lines available per screen is less than four, the results are undefined.

In the following descriptions, the current position refers to two things:

Usually, the line on the screen corresponding to the current position is the third line on the screen. If this is not possible (there are fewer than three lines to display or this is the first page of the file, or it is the last page of the file), then the current position is either the first or last line on the screen as described later.

The number of columns available per line is determined by examining values in the environment (see the ENVIRONMENT VARIABLES section), with a default value as described in the XBD specification, Environment Variables  . The more utility writes lines containing more characters than would fit into this number of columns by breaking the line into one or more logical lines where each of these lines but the last contains the number of characters needed to fill the columns. The logical lines are written independently of each other; that is, commands affecting a single line affect them separately.

When standard output is a terminal and -u is not specified, more treats backspace characters and carriage-return characters specially:

It is implementation-dependent how other non-printable characters are written. Implementations should use the same format that they use for the ex print command.

If the -t option was specified, more will write a screen of the file containing the specified tag in the current position.

If the -p option was specified, more will execute the command supplied in the command option-argument, and write the screen so that the current position is the current position that would result from applying that command to the input file.

If neither the -p or -t options were specified, more will write the first screen of the first input file.

Once the initial screen has been written, more will prompt the user and, based on the interactive user input, will modify the screen or exit. If the modification of the screen results in a screen that has lines in common with the current screen, more will scroll the screen rather than clearing and redrawing the screen (unless the -c option is specified). If the modification of the screen results in a screen that has no lines in common with the current screen, more will clear and redraw the screen.

If the standard output is not a terminal device, more will always exit when it reaches end-of-file on the last file in its argument list. Otherwise, for all files but the last, more will prompt, with an indication that it has reached the end-of-file, along with the name of the next file. For the last file specified, or for the standard input if no file is specified, more will prompt, indicating end-of-file, and accept additional commands. If the next command specifies forward scrolling, more will exit. If the -e option is specified, more will exit immediately after writing the last line of the last file.

Several of the commands described in this section move the current position backwards in the input stream. In the case that text is being taken from a non-rewindable stream, such as a pipe, it is implementation-dependent how much backward motion is supported.

If a scrolling command cannot be performed because there are insufficient lines to scroll, more will alert the terminal. The scrolling commands are b, <control>-B, d, <control>-D, f, <control>-F, g, G, j, k, s, u and <control>-U.

The interactive commands in the following sections are supported. Some commands can be preceded by a decimal integer, called count in the following descriptions. If not specified with the command, count defaults to 1.

In the following descriptions, pattern is a basic regular expression, as described in the XBD specification, Basic Regular Expressions  . The term "examine" is historical usage meaning "open the file for viewing"; for example, more foo would be expressed as examining file foo.

 Help

Synopsis:   h

Write a summary of these commands and other implementation-dependent commands.

 Move Forward One Screenful

Synopsis:   [count]f
Synopsis:   [count]<control>-F

Move forward count lines, with a default of one screenful. At end-of-file, more will continue with the next file in the list, or exit if the current file is the last file in the list.

 Move Backward One Screenful

Synopsis:   [count]b
Synopsis:   [count]<control>-B

Move backward count lines, with a default of one screenful (see option -n). If count is more than the screen size, only the final screenful will be written.

 Scroll Forward One Line

Synopsis:   [count]<space>
Synopsis:   [count]j
Synopsis:   [count]<newline>

Scroll forward count lines. The default count for the space character will be one screenful; for j and newline character, one line. The entire count lines will be written, even if count is more than the screen size. At end-of-file, a newline character will cause more to continue with the next file in the list, or exit if the current file is the last file in the list.

 Scroll Backward One Line

Synopsis:   [count]k

Scroll backward count lines, with a default of 1. The entire count lines will be written, even if count is more than the screen size.

 Scroll Forward One Half Screenful

Synopsis:   [count]d
Synopsis:   [count]<control>-D

Scroll forward count lines, with a default of one half of the screen size. If count is specified, it will become the new default for subsequent d and u commands.

 Skip Forward One Line

Synopsis:   [count]s

Skip forward count lines, with a default of 1, and write the next screenful beginning at that point. If count would cause the current position to be such that less than one screenful would be written, the last screenful in the file will be written.

 Scroll Backward One Half Screenful

Synopsis:   [count]u
Synopsis:   [count]<control>-U

Scroll backward count lines, with a default of one half of the screen size. If count is specified, it will become the new default for subsequent d and u commands.

 Go to Beginning of File

Synopsis:   [count]g

Go to line count in the file, with a default of 1 (beginning of file). Scroll or rewrite the screen so that that line is at the current position.

 Go to End-of-file

Synopsis:   [count]G

Go to line count in the file, with a default of the end of the file. If no count is specified, scroll or rewrite the screen so that the last line in the file is at the bottom of the screen. If count is specified, scroll or rewrite the screen so that that line is at the current position.

 Refresh the Screen

Synopsis:   r
Synopsis:   <control>-L

Refresh the screen.

 Discard and Refresh

Synopsis:   R

Refresh the screen, discarding any buffered input. If the current file is non-seekable, buffered input will not be discarded and the R command is equivalent to the r command.

 Mark Position

Synopsis:   mletter

Mark the current position with the letter named by letter, where letter represents the name of one of the lower-case letters of the portable character set. When a new file is examined, all marks may be lost.

 Return to Mark

Synopsis:   'letter

Return to the position that was previously marked with the letter named by letter, making that line the current position.

 Return to Previous Position

Synopsis:   "

Return to the position from which the last large movement command was executed (where a "large movement" is defined as any movement of more than a screenful of lines). If no such movements have been made, return to the beginning of the file.

 Search Forward for Pattern

Synopsis: [count]/[!]pattern<newline>

Search forward in the file for the countth line containing the pattern. The count defaults to 1. The search will start at the line following the current position. If the search is successful, the screen will be modified so that the searched-for line is in the current position. The null regular expression (/ followed by a newline character) will repeat the search using the previous regular expression. If the character "!" is included, the lines for searching will be those that do not contain the pattern.

If a match is found for the pattern, the logical line containing the pattern will be written in the current position. If the matching line is already on the screen, the screen will be scrolled to make that line the current position; otherwise, a full screen will be written. If no match is found for the pattern, a message to that effect will be written as a part of the prompt, and the screen and the current position will remain unchanged. However, if no match is found and the input is the standard input, the screen may be scrolled to the last screenful of the input.

 Search Backward for Pattern

Synopsis: [count]?[!]pattern<newline>

Search backward in the file for the countth line containing the pattern. The search will start at the line immediately before the current position. If the search is successful, the screen will be modified so that the searched-for line is in the current position. The null regular expression (? followed by a newline character) will repeat the search using the previous regular expression. If the character "!" is included, the lines for searching will be those that do not contain the pattern.

If a match is found for the pattern, the logical line containing the pattern will be written in the current position. If the matching line is already on the screen, the screen will be scrolled to make that line the current position; otherwise, a full screen will be written. If no match is found for the pattern, a message to that effect will be written as a part of the prompt, and the screen and the current position will remain unchanged. However, if no match is found and the input is the standard input, the screen may be scrolled to the last screenful of the input.

 Repeat Search

Synopsis: [count]n

Repeat the previous search for countth line (default 1) containing the last pattern (or not containing the last pattern, if the previous search was /! or ?!).

 Repeat Search in Reverse

Synopsis: [count]N

Repeat the search in the opposite direction of the previous search for the countth line (default 1) containing the last pattern (or not containing the last pattern, if the previous search was /! or ?!).

 Examine New File

Synopsis: :e [filename]<newline>

Examine a new file. If the filename argument is not specified, the current file (see the :n and :p commands below) from the list of files in the command line will be reexamined. The filename will be subjected to the process of shell word expansions (see Word Expansions ); if more than a single pathname results, the effects are unspecified. If filename is a number sign (#), the previously examined file will be reexamined. If filename refers to a non-seekable file, the results are unspecified.

 Examine Next File

Synopsis: [count]:n

Examine the next file. If a number count is specified, the countth next file will be examined. If filename refers to a non-seekable file, the results are unspecified.

 Examine Previous File

Synopsis: [count]:p

Examine the previous file. If a number count is specified, the countth previous file will be examined. If filename refers to a non-seekable file, the results are unspecified.

 Go to Tag

Synopsis: :t tagstring<newline>

Go to the supplied tagstring and scroll/rewrite the screen with that line in the current position; see the -t option. If the ctags utility is not supported by the system, the use of :t produces undefined results.

 Invoke Editor

Synopsis:   v

Invoke an editor to edit the current file being examined. If standard input is being examined, the results are unspecified. The name of the editor will be taken from the environment variable EDITOR , or defaults to vi. If EDITOR represents either vi or ex, the editor will be invoked with options such that the current editor line is the physical line corresponding to the current position in more at the time of invocation. For example, either ex or vi is invoked by specifying the editor name and following that with -c linenumber. It is implementation-dependent whether line-setting options are passed to editors other than vi and ex.

The file types that can be edited are implementation-dependent.

When the editor exits, more will resume on the current file by rewriting the screen with the current line as the current position.

 Display Position

Synopsis:   =
Synopsis:   <control>-G

Write the name of the file currently being examined, the number relative to the total number of files there are to examine, the current line number, the current byte number and the total bytes to write and what percentage of the file precedes the current position. If more is reading from standard input, or the file is shorter than a single screen, some of these items need not be written. All of these items will reference the first byte of the line after the last line written.

 Quit

Synopsis:   q
Synopsis:   :q
Synopsis:   ZZ

Exit more.

 EXIT STATUS

The following exit values are returned:
0
Successful completion.
>0
An error occurred.

 CONSEQUENCES OF ERRORS

If an error is encountered accessing a file when using the :n command, more will attempt to examine the next file in the argument list, but the final exit status will be affected. If an error is encountered accessing a file via the :p command, more will attempt to examine the previous file in the argument list, but the final exit status will be affected. If an error is encountered accessing a file via the :e command, more will remain in the current file and the final exit status will not be affected.

 APPLICATION USAGE

The operating mode referred to for block-mode terminals effectively adds a newline character to each synopsis line that currently has none. So, for example, d<newline> would page one screenful. The mode could be triggered by a command-line option, environment variable or some other method.

When the standard output is not a terminal, none of the filter-modification options are effective. This is based on historical practice. For example, a typical implementation of man pipes its output through more -s to squeeze excess white space for terminal users. When man is piped to lp, however, it is undesirable for this squeezing to happen.

 EXAMPLES

The -p allows arbitrary commands to be executed at the start of each file. Examples are:
more -p G file1 file2
Examine each file starting with its last screenful.
more -p 100 file1 file2
Examine each file starting with line 100 in the current position (usually the third line, so line 98 would be the first line written).
more -p /100 file1 file2
Examine each file starting with the first line containing the string 100 in the current position

 FUTURE DIRECTIONS

The IEEE PASC 1003.2 Interpretations Committee has forwarded concerns about parts of this interface definition to the IEEE PASC 1003.2 Interpretations Committee which is identifying the corrections. A future revision of this specification will align with IEEE Std. 1003.2b when finalised.

 SEE ALSO

None.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]