Displays file contents one screen at a time.
more [ -c ] [ -d ] [ -e ] [ -H ] [ -i ] [ -l ] [ -N ] [ -s ] [ -u ] [ -v ] [ -z ] [ -n Number ] [ -p Subcommand ] [ -t Tagstring ] [ -W Option ] [ -x Tabs ] [ File ... ]
The more command reads files and displays the text one screen at a time. The command pauses after each screen and prints the word More at the bottom of the screen. If you then press a carriage return, the more command displays an additional line. If you press the space bar, the more command displays another full screen of text.
Note: On some terminal models, the more command clears the screen, instead of scrolling.
Instead of naming files to read, you can either redirect or pipe standard output, such as a long directory listing, to the more command. The command adds a % (percent sign) to its prompt when reading from a file rather than a pipe. This provides the percentage of the file (in characters, not lines) that the more command has read.
The more command sets the terminal to NOECHO mode so the output can be continuous. With the exception of the / and ! subcommands, commands that are typed do not normally show up on the terminal. If the standard output is not a terminal, the more command will act just like the cat command, except that a header will be printed before each file in a series.
Environment Variables
Environment variables affect the way the more command works. You can set some environment characteristics in the /etc/environment file and system profile files, such as the .ksh, .csh, and .profile files. Refer to User environment in AIX® Version 7.1 Operating system and device management for discussions about determining and configuring your system environment.
The more command uses the TERM variable to determine terminal characteristics. If this variable is NULL or not set, the command uses the default terminal type. The /usr/share/lib/terminfo directory contains definitions for terminal characteristics.
By default, the more command window size is 2 lines less than what the system terminal is capable of. The command sets the default window size based on the LINES variable. Also, you can easily adjust the window size for each run of the command by adding the -n flag.
Use the MORE variable to customize the more command with your preferred configuration each time the system starts. This variable accepts more command flags.
Item | Description |
---|---|
-c | Prevents the screen from scrolling, which makes text easier to read as the more command writes to the screen. The system ignores the -c flag if the terminal cannot clear to the end of a line. |
-d | Prints a message, appended to the More prompt at the bottom of the screen, about which keys continue, quit, and provide help for the more command. Displays error messages rather than ringing the terminal bell if an unrecognized command is used. This is helpful for inexperienced users. |
-e | Exits automatically after displaying the last line of the last file. |
-H | Disables the search pattern highlighting feature by default. |
-i | Searches for patterns without considering uppercase and lowercase. |
-l | Pauses after detecting a page break in the input. If the -l flag is not used, the more command pauses to accept commands after any line containing a ^L (CTRL-L) character. Also, if a file begins with a FORMFEED, the screen is cleared before the file is printed. |
-N | Suppresses line numbering. The default display, with line numbers, can slow the more command's performance on very large input files. The line numbering feature displays the line number in the = subcommand and passes the line number to the editor (if it is the vi editor). |
-n Number | Configures the more command to display the specified number of lines in the window. Without the -n flag, the more command defaults to two lines less than what the terminal is capable of. For example, on a 24-line terminal, the default is 22 lines. The -n option overrides any values obtained from the environment. |
-p Subcommand | Starts the more command and specified subcommand for each File operand. For example, more -p 50j text1 text2 displays the text1 file at the fiftieth line; then does the same for the text2 file when you finish the first. See "Subcommands" for descriptions of more subcommands. If the command is a positioning command, such as a line number or a regular expression search, set the current position to represent the final results of the command, without writing any intermediate lines of the file. For example, the two commands: more -p 1000j filename more -p 1000G filename are functionally the same and will start the display with the current position at line 1000, passing the lines that j would write and would 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 | Reduces multiple blank lines in the output to only one blank line. The -s flag is particularly helpful in viewing output from the nroff command. |
-t Tagstring | Displays the portion of the file that contains the specified tag. This flag works only on files containing tags created with the ctags command. |
-u | Prevents the more command from treating a backspace character as a printable control character (displayed as a ^H (CTRL-H)), suppressing backspacing, underlining, or creating reverse video text for underlined information in a source file. The -u flag also forces the more command to recognize a carriage-return character, if it exists, at the end of a line. |
-v | Suppresses the graphical translation of nonprinting characters. Without the -v flag, the more command graphically interprets all non-ASCII and most control characters, except Tab, Backspace, and Return. For example, if you do not use the -v flag, the more command displays the non-ASCII characters Ctrl-x as ^X and x as M-x. |
-W Option | Provides the specified Option to the more command
as an extension:
These options control whether the more command sends the initialization strings described, which, for certain terminals (such as some xterms), cause the more command to switch to an alternative screen. The effect of switching screens is to erase the display of the file you were viewing. |
-x Tabs | Sets tab stops at the specified Tabs position. The default tab setting is 8 columns. |
-z | Graphically displays the Tab, Backspace, and Return control characters. With the -z flag, the more command translates the Backspace character as ^H, Return as ^M, and Tab as ^I. |
Subcommands
The more command accepts subcommands when the command pauses and as parameters for the -p flag. Many subcommands take an optional integer, symbolized here by K, which you must enter before the subcommand, with no space between. The more command, in the paused state, processes subcommands immediately and does not require you to press the Enter key.
The more command uses the following subcommands:
Item | Description |
---|---|
h | Displays a help screen that describes the more subcommands. |
v | Starts the vi editor, editing the current file in the current line. |
r or ^L | Refreshes the display. |
R | Refreshes the display and removes buffered input. |
[K](Spacebar) | Moves forward K lines when you press the spacebar. If you do not give a value for K, pressing the spacebar displays the next full screen by default. This spacebar subcommand is the same as [K]f or [K]^F or [K]z. |
[K]f or [K]^F or [K]z | Moves forward K lines, or one full screen if you do not give a value for K. |
[K]b or [K]^B | Moves backward K lines, or one full screen if you do not give a value for K. |
[K]d or [K]^D | Moves forward K lines, or half a screen if you do not give a value for K. If you give a value for K, the more command sets the d and u scroll size to K lines for the session. |
[K]u or [K]^U | Moves backward K lines, or half a screen if you do not give a value for K. If you give a value for K, the more command sets the d and u scroll size to K lines for the session. |
[K]j or [K](Enter) or [K]^E | Moves forward K lines, or one line if you do not give a value for K. |
[K]k or [K]^Y | Moves backward K lines, or one line if you do not give a value for K. |
[K]g | Moves to the beginning of the file, unless you give a line number for K. The default for K is line number 1. |
[K]G | Moves to the last line in the file, unless you give a line number for K. The default for K is the last line in the file. |
[K]p or [K]% | Moves to the point in the file that is K percent of the total file. The default for K is one percent, or the first line in the file. |
ma-z | Marks the current position in the file with the specified letter. |
'a-z | (Single quote) Moves to the position marked with the specified letter. |
'' | (Two single quotes) Returns to the position from which the last large movement (moving more than a page) command was run. If no such movements have been made, returns to the beginning of the file. |
[K]/pattern | (Slash) Searches forward, from the current position, for the specified occurrence of the specified pattern of characters. The default value for K is the first occurrence. |
[K]/!pattern | (Slash, exclamation mark) Searches forward, from the current position, for the specified occurrence of a line that does not contain the specified pattern of characters. The default value for K is the first occurrence. |
[K]?pattern | (Question mark) Searches backward, from the current position, for the specified occurrence of the specified pattern of characters. The default value for K is the first occurrence. |
[K]?!pattern | (Question mark, exclamation mark) Searches backward, from the current position, for the specified occurrence of a line that does not contain the specified pattern of characters. The default value for K is the first occurrence. |
[K]n | Repeats the last search, specifying an occurrence of the pattern (or an occurrence not containing the pattern if the search subcommand included !). The default value for K is the first occurrence. |
:a | Lists the file or files you named in the more command line. |
:f or ^G or = | Displays information about the current file:
|
:e[File] or E[File] | Examines the specified file, provided you named it in the more command line. |
[K]:n or [K]N | Examines either the next file (if you do not give a value for K) or the file K number of positions forward in the list of files you named in the more command line. |
[K]:p or [K]P | Examines either the previous file (if you do not give a value for K) or the file K number of positions backward in the list of files you named in the more command line. |
:t Tagstring | Displays the portion of the file that contains the specified tag. This subcommand works only on files containing tags created with the ctags command. The :t subcommand is the interactive version of the -t flag. |
:q or q or Q | Exits the more command. |
:!command or !command | Starts the specified command in a new shell. |
H | Toggles the search pattern highlighting feature on or off. |
This command returns the following exit values:
Item | Description |
---|---|
0 | Successful completion. |
>0 | An error occurred. |
more myfile
ls -l | more
more -p G file1 file2
more -p 100 file1 file2
Typically,
the current position in a more command display is the third
line on the screen. In this example, the first line on the screen
is the 98th line in the file.more -p /foo file1 file2
The more command
displays the line in the current position, the third line on the screen.Item | Description |
---|---|
/usr/share/lib/terminfo | Indicates the terminal information database. |