more [-ceisu] [-n number] [-p command] [-t tagstring] [file...]
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>. Implementations that support such terminals shall provide an operating mode to more in which all commands can be terminated with a <newline> on those terminals. This mode:
The following options shall be supported:
The filename resulting from the -t option shall be logically added as a prefix to the list of command line files, as if specified by the user. If the tag named by the tagstring argument is not found, it shall be an error, and more shall take no further action.
If the tag specifies a line number, the first line of the display shall contain the beginning of that line. If the tag specifies a pattern, the first line of the display shall contain the beginning of the matching text from the first line of the file that contains that pattern. If the line does not exist in the file or matching text is not found, an informational message to this effect shall be displayed, and more shall display the default screen as if -t had not been specified.
If both the -t tagstring and -p command options are given, the -t tagstring shall be processed first; that is, the file and starting line for the display shall be as specified by -t, and then the -p more command shall be executed. If the line (matching text) specified by the -t command does not exist (is not found), no -p more command shall be executed for this file at any time.
more $MORE options operands
The MORE variable shall take precedence over the TERM and LINES variables for determining the number of lines in a screenful.
The number of lines available per screen shall be 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 shall be used.
The maximum number of lines written shall be one less than this number, because the screen line after the last line written shall be used to write a user prompt and user input. If the number of lines in the screen is less than two, the results are undefined. It is unspecified whether user input is permitted to be longer than the remainder of the single line where the prompt has been written.
The number of columns available per line shall be determined by examining values in the environment (see the ENVIRONMENT VARIABLES section), with a default value as described in the Base Definitions volume of POSIX.1-2017, Chapter 8, Environment Variables.
Lines that are longer than the display shall be folded; the length at which folding occurs is unspecified, but should be appropriate for the output device. Folding may occur between glyphs of single characters that take up multiple display columns.
When standard output is a terminal and -u is not specified, more shall treat <backspace> and <carriage-return> characters specially:
It is implementation-defined how other non-printable characters are written. Implementations should use the same format that they use for the ex print command; see the OPTIONS section within the ed utility. It is unspecified whether a multi-column character shall be separated if it crosses a display line boundary; it shall not be discarded. The behavior is unspecified if the number of columns on the display is less than the number of columns any single character in the line being displayed would occupy.
When each new file is displayed (or redisplayed), more shall write the first screen of the file. Once the initial screen has been written, more shall prompt for a user command. If the execution of the user command results in a screen that has lines in common with the current screen, and the device has sufficient terminal capabilities, more shall scroll the screen; otherwise, it is unspecified whether the screen is scrolled or redrawn.
For all files but the last (including standard input if no file was specified, and for the last file as well, if the -e option was not specified), when more has written the last line in the file, more shall prompt for a user command. This prompt shall contain the name of the next file as well as an indication that more has reached end-of-file. If the user command is f, <control>-F, <space>, j, <newline>, d, <control>-D, or s, more shall display the next file. Otherwise, if displaying the last file, more shall exit. Otherwise, more shall execute the user command specified.
Several of the commands described in this section display a previous screen from the input stream. In the case that text is being taken from a non-rewindable stream, such as a pipe, it is implementation-defined how much backwards motion is supported. If a command cannot be executed because of a limitation on backwards motion, an error message to this effect shall be displayed, the current screen shall not change, and the user shall be prompted for another command.
If a command cannot be performed because there are insufficient lines to display, more shall alert the terminal. If a command cannot be performed because there are insufficient lines to display or a / command fails: if the input is the standard input, the last screen in the file may be displayed; otherwise, the current file and screen shall not change, and the user shall be prompted for another command.
The interactive commands in the following sections shall be supported. Some commands can be preceded by a decimal integer, called count in the following descriptions. If not specified with the command, count shall default to 1. In the following descriptions, pattern is a basic regular expression, as described in the Base Definitions volume of POSIX.1-2017, Section 9.3, 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.
In the following descriptions, unless otherwise specified, line is a line in the more display, not a line from the file being examined.
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.
h
Write a summary of these commands and other implementation-defined commands. The behavior shall be as if the more utility were executed with the -e option on a file that contained the summary information. The user shall be prompted as described earlier in this section when end-of-file is reached. If the user command is one of those specified to continue to the next file, more shall return to the file and screen state from which the h command was executed.
[count]f [count]<control>-F
Scroll forward count lines, with a default of one screenful. If count is more than the screen size, only the final screenful shall be written.
[count]b [count]<control>-B
Scroll backward count lines, with a default of one screenful (see the -n option). If count is more than the screen size, only the final screenful shall be written.
[count]<space> [count]j [count]<newline>
Scroll forward count lines. The default count for the <space> shall be one screenful; for j and <newline>, one line. The entire count lines shall be written, even if count is more than the screen size.
[count]k
Scroll backward count lines. The entire count lines shall be written, even if count is more than the screen size.
[count]d [count]<control>-D
Scroll forward count lines, with a default of one half of the screen size. If count is specified, it shall become the new default for subsequent d, <control>-D, and u commands.
[count]s
Display the screenful beginning with the line count lines after the last line on the current screen. If count would cause the current position to be such that less than one screenful would be written, the last screenful in the file shall be written.
[count]u [count]<control>-U
Scroll backward count lines, with a default of one half of the screen size. If count is specified, it shall become the new default for subsequent d, <control>-D, u, and <control>-U commands. The entire count lines shall be written, even if count is more than the screen size.
[count]g
Display the screenful beginning with line count.
[count]G
If count is specified, display the screenful beginning with the line count. Otherwise, display the last screenful of the file.
r <control>-L
R
Refresh the screen, discarding any buffered input. If the current file is non-seekable, buffered input shall not be discarded and the R command shall be equivalent to the r command.
mletter
Mark the current position with the letter named by letter, where letter represents the name of one of the lowercase letters of the portable character set. When a new file is examined, all marks may be lost.
'letter
Return to the position that was previously marked with the letter named by letter, making that line the current position.
''
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.
[count]/[!]pattern<newline>
Display the screenful beginning with the countth line containing the pattern. The search shall start after the first line currently displayed. The null regular expression ('/' followed by a <newline>) shall repeat the search using the previous regular expression, with a default count. If the character '!' is included, the matching lines shall be those that do not contain the pattern. If no match is found for the pattern, a message to that effect shall be displayed.
[count]?[!]pattern<newline>
Display the screenful beginning with the countth previous line containing the pattern. The search shall start on the last line before the first line currently displayed. The null regular expression ('?' followed by a <newline>) shall repeat the search using the previous regular expression, with a default count. If the character '!' is included, matching lines shall be those that do not contain the pattern. If no match is found for the pattern, a message to that effect shall be displayed.
[count]n
Repeat the previous search for countth line containing the last pattern (or not containing the last pattern, if the previous search was "/!" or "?!").
[count]N
Repeat the search in the opposite direction of the previous search for the countth line containing the last pattern (or not containing the last pattern, if the previous search was "/!" or "?!").
:e [filename]<newline>
Examine a new file. If the filename argument is not specified, the current file (see the :n and :p commands below) shall be re-examined. The filename shall be subjected to the process of shell word expansions (see Section 2.6, Word Expansions); if more than a single pathname results, the effects are unspecified. If filename is a <number-sign> ('#'), the previously examined file shall be re-examined. If filename is not accessible for any reason (including that it is a non-seekable file), an error message to this effect shall be displayed and the current file and screen shall not change.
[count]:n
Examine the next file. If a number count is specified, the countth next file shall be examined. If filename refers to a non-seekable file, the results are unspecified.
[count]:p
Examine the previous file. If a number count is specified, the countth previous file shall be examined. If filename refers to a non-seekable file, the results are unspecified.
:t tagstring<newline>
If the file containing the tag named by the tagstring argument is not the current file, examine the file, as if the :e command was executed with that file as the argument. Otherwise, or in addition, display the screenful beginning with the tag, as described for the -t option (see the OPTIONS section). If the ctags utility is not supported by the system, the use of :t produces undefined results.
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 shall be taken from the environment variable EDITOR, or shall default to vi. If the last pathname component in EDITOR is either vi or ex, the editor shall be invoked with a -c linenumber command line argument, where linenumber is the line number of the file line containing the display line currently displayed as the first line of the screen. It is implementation-defined whether line-setting options are passed to editors other than vi and ex.
When the editor exits, more shall resume with the same file and screen as when the editor was invoked.
= <control>-G
Write a message for which the information references the first byte of the line after the last line of the file on the screen. This message shall include the name of the file currently being examined, its number relative to the total number of files there are to examine, the line number in the file, the byte number and the total bytes in the file, 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, the line number, the byte number, the total bytes, and the percentage need not be written.
q :q ZZ
The following sections are informative.
There are inconsistencies between more and vi that result from historical practice. For example, the single-character commands h, f, b, and <space> are screen movers in more, but cursor movers in vi. These inconsistencies were maintained because the cursor movements are not applicable to more and the powerful functionality achieved without the use of the control key justifies the differences.
The tags interface has been included in a program that is not a text editor because it promotes another degree of consistent operation with vi. It is conceivable that the paging environment of more would be superior for browsing source code files in some circumstances.
The operating mode referred to for block-mode terminals effectively adds a <newline> 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. The details are not imposed by this volume of POSIX.1-2017 because there are so few systems known to support such terminals. Nevertheless, it was considered that all systems should be able to support more given the exception cited for this small community of terminals because, in comparison to vi, the cursor movements are few and the command set relatively amenable to the optional <newline> characters.
Some versions of more provide a shell escaping mechanism similar to the ex ! command. The standard developers did not consider that this was necessary in a paginator, particularly given the wide acceptance of multiple window terminals and job control features. (They chose to retain such features in the editors and mailx because the shell interaction also gives an opportunity to modify the editing buffer, which is not applicable to more.)
The -p (position) option replaces the + command because of the Utility Syntax Guidelines. The +command option is no longer specified by POSIX.1-2008 but may be present in some implementations. In early proposals, it took a pattern argument, but historical less provided the more general facility of a command. It would have been desirable to use the same -c as ex and vi, but the letter was already in use.
The text stating ``from a non-rewindable stream ... implementations may limit the amount of backwards motion supported'' would allow an implementation that permitted no backwards motion beyond text already on the screen. It was not possible to require a minimum amount of backwards motion that would be effective for all conceivable device types. The implementation should allow the user to back up as far as possible, within device and reasonable memory allocation constraints.
Historically, non-printable characters were displayed using the ARPA standard mappings, which are as follows:
The display of characters having their eighth bit set was less standard. Existing implementations use hex (0x00), octal (\000), and a meta-bit display. (The latter displayed characters with their eighth bit set as the two characters "M-", followed by the seven-bit display as described previously.) The latter probably has the best claim to historical practice because it was used with the -v option of 4 BSD and 4 BSD-derived versions of the cat utility since 1980.
No specific display format is required by POSIX.1-2008. Implementations are encouraged to conform to historic practice in the absence of any strong reason to diverge.
The Base Definitions volume of POSIX.1-2017, Chapter 8, Environment Variables, Section 9.2, Regular Expression General Requirements, Section 9.3, Basic Regular Expressions, Section 12.2, Utility Syntax Guidelines
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .