Previous | Table of Contents | Next |
DESCRIPTION
The external more command allows you to peruse a file on your terminal. It is a filter that reads the standard input or files. It lets you view one screen of text at a time.
The page command performs the same function as more with a different screen control. The screen is cleared before each full screen of text is displayed. It also displays ROWS - 1 rather than ROWS - 2 rows of text, where ROWS is the number of lines on your terminal screen.
COMMAND FORMAT
Following is the general format of the more command.
more [ -cdflsuw ] [ -rows ] [ +linenum ] [ +/pattern] [ file_list ] page [ -cdflsuw ] [ -rows ] [ +linenum ] [ +/pattern ] [ file_list ]
BSD (Berkeley)
more [ -cdflsu ] [ -rows ] [ +linenum ] [ +/pattern ] [ file_list ] page [ -cdflsu ] [ -rows ] [ +linenum ] [ +/pattern ] [ file_list ]
Options
The following list describes the options and their arguments that may be used to control how more functions.
-c | Draw each screen of text line-by-line. Each line is erased just before the new text is written to the line. This provides a more controlled screen, allowing for easier reading of existing text while new text is being displayed. If the terminal cannot perform a clear-to-end-of-line function, the option is ignored. |
-d | Changes the prompt to be "Press space to continue, 'q' to quit." from "--More--(9%)." If an incorrect response is entered, then the message "Press 'h' for instructions." is displayed instead of sounding the terminal bell. This is useful for application shell programming where more is used as an interface to unsophisticated users. |
-f | Do not fold long lines. Count logical lines instead of screen lines. Normally more truncates lines longer than the width of the screen (environment variable COLUMNS). This option allows you to pipe nroff output to ul then into more without having lines folded (truncated) because of embedded escape sequences. |
-l | Do not process form feeds as special characters. Normally more pauses before each form feed, assuming the end of a page of text has been reached. A form feed at the beginning of a file normally causes more to clear the screen before displaying text from the file. |
-s | Squeeze out adjacent blank lines. Two or more blank lines grouped together are reduced to one blank line. This increases the amount of text displayed on the screen. It is very useful when viewing nroff output. |
-u | Suppress underlining and standout (bold) mode. The normal sequences for underlining and standout mode are stripped from the output. |
-w | Prompts and waits for any key to be pressed before exiting. By default more/page will exit without waiting upon reaching the end-of-file. |
-rows | Specifies the number of rows (lines) to display on your terminal screen. Resets the size, in lines, of your window to rows |
+linenum | Begin displaying text at line number linenum of the input. |
+/pattern | Begin displaying text two lines before the line containing the regular expression pattern. |
Arguments
The following list describes the arguments that may be passed to the more command.
file_list | The list of files to be read by more. |
If no files are specified, more reads from the standard input, which may be your keyboard or from a pipe. |
Internal Commands
After more starts displaying text you can enter commands at the "--More--" prompt to perform certain functions. The following commands may be used.
nSpace | Display n more lines of text. If n is not specified, then 22 more lines of text (one screen) are displayed. |
= | Display the current line number. |
' (single quote) | Go to the line where the last search began. If a search has not been performed in the current file, then go to the beginning of the file. Only works when reading files. Does not work on standard input. |
. (period) | Repeat the previous command. |
n/expr | Search for the nth occurrence of the regular expression expr. If the input is a file rather than standard input (a pipe) and there are fewer than n occurrences of expr, the position within the file remains unchanged. If n occurrences of expr exist, then more displays two lines before the location of expr. If you backspace over the / the search is canceled. While typing the expr you may use the Backspace and Kill characters. |
nCtrl-B | |
nb | Skip n full screens back and display the next full screen of text. Does not work on standard input if the amount of text is very large. |
nCtrl-D | |
nD | |
nd | Scroll 11 more lines of text onto the screen. If n is specified the scroll size is changed from 11 to n lines. |
nf | Skip n full screens ahead and display the next full screen of text. |
h | Help. Display a description of all of these help commands. |
nn | Search for the nth occurrence of the last regular expression you specified. |
Q | |
q | Quit the program (exit more or page). |
ns | Skip n lines forward in the text and display the next full screen of text. |
v | Start the vi editor at the current line. Only works when viewing files on most systems. Does not work on standard input. |
nz | Reset the window size to n lines. The z performs the same function as pressing Spacebar, except if n is specified the window size is reset. |
:f | Display the current filename and line number. |
n:n | Skip to the nth next file given on the command line. If no more
files exist more exits. If fewer than n files exist then
more skips forward to the last file. If more is reading the
standard input, then the command is ignored. The following line is displayed at
the bottom of your screen.
--More--(Next file: filename) |
n:p | Skip to the nth previous file given on the command line. If n
is greater than the number of previous files, then more returns to file
one. If you have displayed part of the current file, more returns to the
top of the current file. If more is reading the standard input, then the
command is ignored. The following line is displayed at the bottom of your
screen.
--More--(Next file: filename) |
:q | |
:Q | Quit for more or page. |
!command | Invoke a shell which executes command. For example,
!lp -dlj % |
performs a sh -c lp -dlj filename where filename is the current file you are displaying. The percent (%) sign is expanded to the current filename. The exclamation point (!) is expanded to the last command specified. If there is a current filename, the % is not expanded. You can escape the % and ! by typing \% and \!. |
SCREEN VIEWING
After each screen more pauses and displays the "--More--" prompt at the bottom left corner of the screen. If the input is from a file, instead of a pipe (standard input), more reports the percentage of total text displayed so far and the prompt becomes "--More--(17%)." If you press Spacebar at the prompt, the next screen of text is displayed. Pressing Return displays the next line of text.
SCREEN CONTROL
The screen control characteristics used by more are retrieved from the /etc/termcap database. Some System V UNIX systems implement more; in this case the characteristics may be retrieved from the terminfo database. The clear screen sequence is needed, along with the default window size and cursor positioning. If the window size is 24 lines, more displays 22 lines of text.
OUTPUT STYLE
If the standard output is not a tty (terminal), more behaves like the head command. It displays a header and the contents of the file for each file listed.
ENVIRONMENT VARIABLE CONTROL
You can set the environment variable MORE to any flags you desire to use each time you invoke more. For example, if you always wish to use the -d option, you perform the ksh (sh) command,
MORE='-d'; export MORE
or the csh command,
setenv MORE -d
to cause all executions of more to use the -d option. Normally, you place these commands in your .cshrc or .profile (.kshrc) files appropriately.
DIAGNOSTICS AND BUGS
Skipping backward may be extremely slow on large files.
RELATED COMMANDS Refer to the cat and pg commands described in modules 13 and 103.
RELATED FILES
The more command uses the following files.
/usr/share/lib/termcap Terminal capabilities database.
/usr/lib/more.helpThe help file - for more.
|
|
---|---|
BSD (Berkeley) | |
/etc/termcap | Terminal capabilities database. |
/usr/lib/more.help | The help file for more. |
|
APPLICATIONS
The most common use of more is to display large files or output from a pipe to your screen one screen at a time. It is also useful for help screens in shell applications. You can create a help file exactly a multiple of 22 lines and have more display it within your shell script. This provides you with a professional and consistent interface for your users.
TYPICAL OPERATION
In this activity you use the more command to display the contents of three files. Begin at the shell prompt.
...Skipping ...Skipping to file /u1/ts/mylogin/file1 --More--(Next file: /u1/ts/mylogin/file1)
...Skipping ...Skipping to file /etc/group --More--(Next file: /etc/group)
|
|
---|---|
BSD (Berkeley) | |
Type !lpr % and press Return to print a copy of your $HOME/file1 to the default printer. | |
|
Previous | Table of Contents | Next |