More (Unix)

From Wikipedia, the free encyclopedia

The correct title of this article is more (Unix). The initial letter is shown capitalized due to technical restrictions.
Example output of the more command.
Example output of the more command.

more is a program on Unix and Unix-like systems used to view (but not modify) the contents of a text file one screen at a time. Programs of this sort are called pagers. [1] more is a very basic pager, originally allowing only forward navigation through a file, though newer implementations do allow for limited backward movement.

Contents

[edit] History

The more command was originally written by Daniel Halbert, a graduate student at the University of California, Berkeley, in 1978. It was first included in 3.0 BSD, and has since become a standard program in all Unix systems. A clone of more was included in MS-DOS.

[edit] Usage

The command-syntax is:

more [options] [file_name]

If no file name is provided, more looks for input from stdin.

Once more has obtained input, it displays as much as can fit on the current screen and waits for user input to advance, with the exception that a line feed (^L) will also cause more to wait at that line, regardless of the amount of text on the screen. In the lower-left corner of the screen is displayed the text "--More--" and a percentage, representing the percent of the file that more has paged through. (This percentage includes the text displayed on the current screen.) When more reaches the end of a file (100%) it exits. The most common methods of navigating through a file are Enter, which advances the output by one line, and Space, which advances the output by one screen.

There are also other commands that can be used while navigating through the document; consult more's man page for more details. [2]

[edit] Options

Options are typically entered before the file name, but can also be entered in the environment variable $MORE. Options entered in the actual command line will override those entered in the $MORE environment variable. Available options may vary between Unix systems, but a typical set of options is as follows:

-num
This option specifies an integer which is the screen size (in lines).
-d
more will prompt the user with the message "[Press space to continue, 'q' to quit.]" and will display "[Press 'h' for instructions.]" instead of ringing the bell when an illegal key is pressed.
-l
more usually treats ^L (form feed) as a special character, and will pause after any line that contains a form feed. The -l option will prevent this behavior.
-f
Causes more to count logical, rather than screen lines (i.e., long lines are not folded).
-p
Do not scroll. Instead, clear the whole screen and then display the text.
-c
Do not scroll. Instead, paint each screen from the top, clearing the remainder of each line as it is displayed.
-s
Squeeze multiple blank lines into one.
-u
Suppress underlining.
+/
The +/ option specifies a string that will be searched for before each file is displayed. (Ex.: more +/Preamble gpl.txt)
+num
Start at line number num.

[edit] External links


In other languages