more

display files on a page-by-page basis

Command


SYNOPSIS

more [-ceiSs] [-A|-u] [-n number] [-P prompt] [-p command] [-t tag] [file ...]

more [-ceiSs] [-A|-u] [-n number] [-P prompt] [-t tag] [+command] [file ...]


DESCRIPTION

The more command displays files one page at a time. It obtains the number of lines per page from the environment or from the -n option. If the standard output is not a terminal device, the number of lines per page is infinite.

If more than one file is specified, they are displayed one at a time. When more finishes displaying one file, it begins displaying the next one in the list. If you give - as one of the file names, more reads the standard input at that point in the sequence.

more allows paging forwards and backwards (if possible) and searching for strings.

Options

-A

causes the display of all characters, including unprintable ones. Normally unprintable characters are displayed in a printable format. Further, ANSI escape sequences for display modes are processed. This option cannot be used with -u.

Note:

The character in the top left corner of the screen always appears in normal mode.

-c

clears the screen before displaying a new file. If at any time, the new screen to be displayed does not have any lines in common with the current screen, more does not scroll, but instead, redraws the screen one line at a time, starting from the top. more may ignore this option if the terminal does not support such operations.

-e

exits immediately after displaying the last line of the last file. Normally, if standard output is a terminal device, more stops after displaying the last line of the last file and prompts for a new command. If the command that displays text causes more to reach the end of the file again, more exits.

-i

ignores case during searches.

-n number

specifies the number of lines per page. This overrides any values obtained from the environment.

-P string

sets the prompt that appears at end of each page of text to string. The default prompt is [filename]. more normally displays the prompt in STANDOUT mode.

-p command
+command

initially executes the more command on each file. If it executes successfully and command is a positioning command such as a line number or a regular expression search, more displays the resulting page; otherwise more displays the first page of the file. If both the -t and -p options are specified, the -t option is processed first.

-S

displays the prompt in normal mode rather than STANDOUT mode.

-s

replaces consecutive empty lines with a single empty line. Remember that all line numbers (for example, as specified with the p) will refer to the lines in the new file (that is, the file with the consecutive empty lines replaced).

-t tag

searches for the named tag and displays the page of text containing it. See ctags for more information.

-u

displays all backspaces as ^H. Normally characterbackspace_(underscore) displays character as underlined and characterbackspacecharacter displays character as boldfaced. -u also displays all carriage returns as ^M. This option cannot be used with -A.

Interactive Commands

more also accepts the following interactive commands.
[n]b
[n]CTRL-B
[n]PgUp

moves backward n lines, with a default of one page. If n is more than the page size, more displays only the final page.

[n]d
[n]CTRL-D

scrolls forward n lines, with a default of one half of the page size. If you specify n, it becomes the new default for subsequent d and u commands.

[n]f
[n]CTRL-F
[n]PgDn

moves forward n lines, with a default of one page. At end-of-file, more continues with the next file in the list, or exits if the current file is the last one in the list.

[n]G

goes to the nth line in the file. If you do not specify n, more advances to the end of the file.

[n]g

goes to the nth line in the file, with the default being the first line of the file.

h

displays a summary of interactive commands.

[n]j
[n]SPACE
[n]ENTER
[n]

scrolls forward n lines, with a default of one line for j, ENTER and , and a default of one page for SPACE. This command displays the entire n lines even if n is more than the page size. At end-of-file, these commands cause more to begin displaying the next file in the list, or to exit if the current file is the last one in the list.

[n]k
[n]

scrolls backward n lines, with a default of one line. This command displays the entire n lines even if n is more than the page size.

mletter

marks the current position with the lowercase letter. When you view a new file, all previous marks are lost.

[n]N

repeats the previous search, but in the opposite direction. If you specify n, more repeats the search n times.

[n]n

repeats the previous search. If you specify n, more repeats the search n times.

For example, if there are eight occurrences of pattern in the file and /pattern found the second occurrence, a follow-up command of 5n finds and sets the current position to the 7th occurrence of pattern.

q
:q
ZZ

exits more.

R

refreshes the screen and discards any buffered input.

r
CTRL-L

refreshes the screen.

[n]s

skips forward n lines (with a default of one line) and displays one page beginning at that point. If n would cause less than a full page to be displayed, more displays the last page in the file.

[n]u
[n]CTRL-U

scrolls backward n lines, with a default of one half of the page size. If you specify n, it becomes the new default for subsequent d and u commands.

v

invokes an editor to edit the current file. more uses the editor named by the environment variable EDITOR. The default editor is vi.

'letter

returns to the position marked with letter.

''

returns to the position where you last issued a movement command of greater than one page or the beginning of the file if you have issued no such commands.

:e [filename]ENTER

stops viewing the current file and views filename instead. If you do not specify filename, more returns to the beginning of the current file. If filename is #, more returns to the last file viewed before the current one.

[n]:n

views the next file from the list given on the command line. If you specify n, more views the nth next file from the list.

[n]:p

views the previous file from the list given in the command line. If you specify n, more views the nth previous file from the list.

:t tagname

goes to tagname (see ctags).

:w filename

writes the contents of the current file to the file filename.

!sh_cmd

escapes to shell and executes sh_cmd as a shell command.

=
CTRL-G

displays, where possible, the name of the file currently being viewed, its number (relative to the total number of files specified in the command line), the current line number, the current byte number, the total bytes to display and what percentage of the file has been displayed.

[n]/[!]pattern

searches forward in the file for the nth line containing pattern. n defaults to one if not specified. If pattern is the null regular expression (/), more uses the previous pattern. If the character ! precedes pattern, more searches for lines that do not contain pattern.

[n]?[!]pattern

searches backward in the file for the nth line containing pattern. The search begins at the line immediately before the top line displayed. n defaults to one if not specified. If pattern is the null regular expression (?), more uses the previous pattern. If the character ! precedes pattern, more searches for lines that do not contain pattern.

HOME

goes to the first line in the file.

END

goes to the last line in the file.


ENVIRONMENT VARIABLES

COLUMNS

contains the maximum number of columns to display on one line.

EDITOR

contains the name of the editor that the v command invokes.

LINES

contains the number of lines in a page. This value takes precedence over the value provided by TERM; however, the -n value takes precedence over the LINES value.

MORE

contains a list of options (from those listed in the Options section) as they would appear on the command line. This variable takes preference over the TERM and LINES variables.

TERM

contains the name of the terminal type.


DIAGNOSTICS

Possible exit status values are:
0

Successful completion.

>0

Failure due to any of the following:

filename not a text file
-n option too large
— syntax error in regular expression
— inability to create a file
— inability to open input file
— insufficient memory
— invalid command
— inability to access the terminal
— missing string after -p option


PORTABILITY

POSIX.2. x/OPEN Portability Guide 4.0.

The -A, -P and -S options, and the :w and ! commands are extensions to the POSIX standard. The HOME, END, PgDn, PgUp, and commands are extensions to traditional implementations of more, available only on terminal types that support these keys.


SEE ALSO

Commands:
cat, ctags, vi


Updated MKS Toolkit [3khat16.ico]HP3000 [3khat16.ico]3kMail [archive16.gif]