more, less

display files on a page-by-page basis 

Command


SYNOPSIS

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

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

less [-ceiSs] [-A|-u] [-n number] [-P prompt] [-p command] [-t tag] [-U[[[c][lb8oa]][p[lb8oa]]]] [file ...]

less [-ceiSs] [-A|-u] [-n number] [-P prompt] [-t tag] [+command] [-U[[[c][lb8oa]][p[lb8oa]]]] [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. The less command is identical to the more command.

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.

Besides normal ASCII text files, these utilities also work on UTF-8 files and 16-bit wide Unicode files. Such files normally begin with a multiple-byte marker indicating whether the file's contents are Unicode big-endian, Unicode little-endian, or UTF-8. Such files are detected automatically by these utilities; however, when the multiple-byte marker is missing you can use the -U option or the TK_STDIO_DEFAULT_INPUT_FORMAT/TK_STDIO_DEFAULT_OUTPUT_FORMAT environment variables to force any file to be treated as a Unicode or UTF-8 file.

Normally, the output format of these utilities defaults to the format of the first file it displays unless the -U option or the TK_STDIO_DEFAULT_OUTPUT_FORMAT environment variable is used to override the output format. For more details on this and other Unicode-related file handling issues see the unicode reference page.

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[[[c][lb8oa]][p[lb8oa]]] 

specifies the input format of any file missing the initial multiple-byte marker, the output format produced, or both.

When c is specified, the specifiers that follow it apply to the input consumed.

When p is specified, the specifiers that follow it apply to the output produced.

When neither c nor p are specified, the remaining -U specifiers apply to the input consumed.

When both c and p are specified, the remaining -U arguments apply to both input and output.

The remaining specifiers indicate the format of the characters read from input or written to output (as determined by c and p):

l     little-endian 16-bit wide characters
b     big-endian 16-bit wide characters
8     UTF-8 characters
a     ASCII characters from the ANSI code page
o     ASCII characters from the OEM code page

When multiple format specifiers can be associated with either c or p, the last appropriate one given on the command for each of c and p is used. For example:

-Ucoapl8

is the same as:

-Ucap8

When a p specifier is given without a c specifier and format specifiers are given before the p specifier, those format specifiers apply to the input. For example:

-Uopl

is the same as:

-Ucopl

When c or p is specified with no format specifies, little endian 16-bit wide characters are used by default for either input or output, as appropriate.

As an alternative to specifying formats for both input and output with the same -U option, you can specify the -U option multiple times. For example, the following are identical:

-Uca -Upb
-Ucapb

Note:

The -U specifiers are actually case-insensitive. For example, the following are all identical in their behavior:

-Ucl
-UcL
-UCl
-UCL

-u 

displays all backspaces as ^H. Normally characterbackspace_(underscore) displays character as underlined and characterbackspacecharacter displays character as bold-faced. -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.

TK_STDIO_DEFAULT_INPUT_FORMAT 

Sets the default input format for files that don't have the initial multibyte marker. The value must be one of those listed in the File Character Formats section of the unicode reference page.

TK_STDIO_DEFAULT_OUTPUT_FORMAT 

Sets the default output format. Normally the format of the first file read is used as the default output format. The value must be one of those listed in the File Character Formats section of the unicode reference page.


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. All UNIX systems. Windows 7. Windows Server 2008 R2. Windows 8. Windows Server 2012. Windows 10. Windows Server 2016.

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.


NOTE

The MKS more command should not be confused with any more commands supplied with your operating system.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC Integrity


SEE ALSO

Commands:
cat, ctags, pg, vi


PTC MKS Toolkit 10.1 Documentation Build 15.