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

Format

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

more [-BceiSsU] [-A| -u] [-n number] [-P prompt] [-ttag] -W option[option] ... [+command] [file ... file ...]

Description

more displays files one page at a time. It obtains the number of lines per page from the environment or from the –n option. If standard output (stdout) is not a terminal device, the number of lines per page is infinite. If stdout is not a terminal device, all input files are copied to stdout in their entirety, without modification.

more displays the files that are specified by filefile ... (that is, a list of file names) 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
Displays all characters, including unprintable ones. Typically, unprintable characters are displayed in a format that is printable, such as octal. However, with -A, the actual glyph (graphical character) is displayed. Also, by using this option, ANSI escape sequences for display modes are processed. This option cannot be used with -u.
Note: The character in the upper left corner of the screen is always displayed in normal mode.
-B
Disables the automatic conversion of tagged files. This option is ignored if the filecodeset or pgmcodeset options (-w option) are specified.
-c
Displays one page at a time starting at the top of the screen, and clears the screen before displaying a new file. more may ignore this option if the terminal doesn't support such operations.
-e
Exits immediately after displaying the last line of the last file. Typically, if stdout 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 that are obtained from the environment. Use this option when you need to override the curses screen length or LINES setting to work with your terminal. This option will give incorrect results if used while in the OMVS shell (or another dumb terminal) and specifying number to be something other than the current number of screen lines.
-P string
Sets the prompt that appears at end of each page of text to string. The default prompt is [filename]. more typically displays the prompt in standout mode.
-p 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.
+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 (reverse video) mode.
-s
Replaces consecutive empty lines with a single empty line.
-t tag
Searches for the named tag and displays the page of text containing it. See ctags for more information.
-U
Allows more to refresh the display screen for each new line.
-u
Displays all backspaces as ^H.

Typically, character-backspace_(underscore) displays character as underlined and character-backspace-character displays character as boldfaced. -u also displays all carriage returns as ^M. This option cannot be used with -A.

-W option[,option]...
Specifies z/OS-specific options. The option keywords are case-sensitive. Possible options are:
filecodeset=codeset
Performs text conversion from one code set to another when reading from the file. The coded character set of the file is codeset. codeset can be a code set name that is known to the system or a numeric coded character set identifier (CCSID). The command iconv -l lists existing CCSIDs along with their corresponding code set names. The filecodeset and pgmcodeset options can be used on files with any file tag.

If pgmcodeset is specified but filecodeset is omitted, then the default file code set is ISO8859-1 even if the file is tagged with a different code set. If neither filecodeset nor pgmcodeset is specified, text conversion will not occur unless automatic conversion is enabled or the _TEXT_CONV environment variable indicates text conversion. For more information about text conversion, see Controlling text conversion for z/OS UNIX shell commands.

If filecodeset or pgmcodeset is specified, then automatic conversion is disabled for this command invocation and the -B option is ignored if it is also specified. See z/OS UNIX System Services Planning for more information about automatic conversion.

When specifying values for filecodeset, use the values that Unicode Service supports. For more information about supported code sets, see z/OS Unicode Services User's Guide and Reference.

pgmcodeset=codeset
Performs text conversion from one code set to another when reading from the file. The coded character set of the program (command) is codeset. codeset can be a code set name that is known to the system or a numeric coded character set identifier (CCSID). Note that the command iconv -l lists existing CCSIDs along with their corresponding code set names. The filecodeset and pgmcodeset options can be used on files with any file tag.

If filecodeset is specified but pgmcodeset is omitted, then the default program code set is IBM-1047. If neither filecodeset nor pgmcodeset is specified, text conversion will not occur unless automatic conversion is enabled or the _TEXT_CONV environment variable indicates text conversion. For more information about text conversion, see Controlling text conversion for z/OS UNIX shell commands.

If filecodeset or pgmcodeset is specified, then automatic conversion is disabled for this command invocation and the -B option is ignored if it is also specified. See z/OS UNIX System Services Planning for more information about automatic conversion.

The only supported values for pgmcodeset are IBM-1047 and 1047.

Interactive commands

more also supports the following interactive commands.

Interactive command Action
[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]↓ (down arrow)
Scrolls forward n lines, with a default of one line for j, ENTER and (down arrow), 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]↑ (up arrow)
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 then 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 one 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. If the editor is ex or vi, the text conversion that is specified on the more command (for example, the -B or -W option) is used.
'letter Returns to the position marked with letter.
'' Returns to the position from which you last issued a movement command of greater than one page or the beginning of the file if you have issued no such commands.
Note: '' indicates two single quotation marks, not one double quotation mark.
[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.
:e [filename]newline 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. The text conversion that is specified on the more command (for example, the -B or -W option) is used.
[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.
:w filename Writes the contents of the current file to the file filename. The text conversion that is specified on the more command (for example, the -B or -W option) is used.
!<shell command> Escape to shell and execute shell command.
= 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.
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.
Home Goes to the first line in the file.
End Goes to the last line in the file.

Examples

  1. To display a text file one page at a time starting at line 12:
    more +12g myTextFile
  2. To display a text file containing UTF-8 characters one page at a time, assuming that:
    • The text file is untagged and you do not want to tag it or enable automatic conversion, and
    • You cannot alter the tag (for example, you are displaying an untagged public text file or a read-only text file):
    more -W filecodeset=1208,pgmcodeset=IBM-1047 myutf8File
  3. To display a text file containing EBCDIC characters one page at a time, assuming that automatic conversion has been enabled but the text file is incorrectly tagged as ASCII:
    more -B myMisTaggedFile

Environment variables

more uses the following environment variables:
_TEXT_CONV
Contains text conversion information for the command. The text conversion information is not used when either the -B option or the filecodeset or pgmcodeset option (-W option) is specified. For more information about text conversion, see Controlling text conversion for z/OS UNIX shell commands.
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 value from TERM. However, the -n value takes precedence over the LINES value.
MORE
Contains a list of options 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.

Usage notes

more is designed for raw-mode terminals. It can be used with 3270 terminals with certain restrictions. Line-mode terminals require a user to press Enter to allow the keys typed to be processed. However, the Enter key has a special meaning to more. Specifically, it causes more to scroll down a single line. Therefore, when attempting to use more while in line-mode, each time a user presses "Enter" to process any command, this causes the screen to scroll down a single line at a time.

Localization

more uses the following localization environment variables:
  • LANG
  • LC_ALL
  • LC_MESSAGES
  • LC_SYNTAX
  • NLSPATH

See Localization for more information.

Exit values

0
Successful completion
>0
Failure due to any of the following:
  • filename is 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
  • Incorrect command
  • Inability to access the terminal
  • Missing string after -p option
  • The code set is not valid
  • Could not turn off automatic conversion
  • Could not perform requested text conversion

Portability

POSIX.2 User Portability Extension, UNIX systems.

The -A, -B, -P, -s, -U, and -W options and the :w and ! commands are extensions of the POSIX standard. The Home, End, PgDn, PgUp, ↓ (down arrow), and ↑ (up arrow) commands are extensions to traditional implementations of more, available only on terminal types that support these keys.

Related information

cat, vi