Linux more control

Updated: 11/06/2021 by Reckoner Promise

more command

On Unix-like operating systems, the more command displays text, one screen at a time.

This page covers the GNU/Linux version of more.

Clarification

more is a filter for paging through text one screen at a time. It does not provide as many options or enhancements every bit less, but is still quite useful and simple to use.

Syntax

more than [-dlfpcsu] [-num            lines] [+/pattern] [+linenum] [file            ...]

Options

-num lines Sets the number of lines that makes upwardly a screenful. The lines must be an integer.
-d With this option, more prompts the user with the message "[Press space to proceed, 'q' to quit.]" and display "[Press 'h' for instructions.]" when an illegal key is pressed, instead of ringing a bell.
-fifty more usually treats ^L (Control-50, the class feed) equally a special graphic symbol, and pauses after whatever line containing it. The -l selection prevents this behavior.
-f Causes more than to count logical, rather than screen lines (i.east., long lines are not wrapped).
-p Practice non scroll. Instead, clear the whole screen and then display the text. This option is switched on automatically if the more executable is named page.
-c Practise not scroll. Instead, pigment each screen from the acme, clearing the remainder of each line equally it is displayed.
-s Squeeze multiple bare lines into one bare line.
-u Practice not display underlines.
+/ string Search for the string cord, and advance to the commencement line containing string when the file is displayed.
+ num Starting time displaying text at line number num.

Commands

When displaying a file, more can be controlled with a set of commands loosely based on the text editor vi. Some commands can be preceded by a decimal number referred to as k in the following descriptions.

h, ? Show help (display a brief control summary). If you lot forget all the other commands, call back this i!
[k]Infinite Pressing the spacebar displays the adjacent yard lines of text. If thou is not specified, more displays a total screen of new text.
[m]z Like pressing SPACE, only m becomes the new default number of lines to display.
[yard]RETURN Pressing the Enter or Return key displays next yard lines of text. The default is i line. If specified, k becomes the new default.
[k]d, [k]^D Pressing d or CONTROL-D scrolls 1000 lines. The default is the electric current roll size, which is initially 11 lines. If specified, thousand becomes the new default.
q, Q, ^C Pressing q, Q, or CONTROL-C (the interrupt cardinal) exits the program.
[k]s Skip forward one thousand lines of text. Defaults to one.
[g]f Skip forward k screenfuls of text. Defaults to ane.
b, ^B Pressing b or CONTROL-B skips backward k lines of text. Defaults to 1. (This simply works when viewing files, not piped input).
' Get to the place where the previous search started.
= Display the current line number.
[thousand]/ blueprint Search for the thouth occurrence of the regular expression pattern. Defaults to 1.
[yard]due north Search for the kth occurrence of the last regular expression searched for, which defaults to 1.
! command, :! command Execute command in a subshell.
v Start up an editor at current line. The editor is taken from the environment variable VISUAL if it's defined, or EDITOR if VISUAL is undefined; if neither is defined, defaults to "vi".
^L Pressing CONTROL-50 redraws the screen.
[g]:n Go to the gth next file. Defaults to i.
[thousand]:p Go to the kth previous file. Defaults to i.
:f Brandish the current file name and line number.
. Echo previous command.

Environment

more uses the values of the following environment variables, if they are defined:

MORE Default more options. If this variable is fix, more reads as the default fix of options to use. Any options specified on the command line override the options specified in $More.
SHELL The electric current beat in utilize (this variable is normally set past the vanquish itself at login time).
TERM The current terminal type. This value is used by more to determine the proper way to dispense the screen.

Examples

more +three myfile.txt

Display the contents of file myfile.txt, beginning at line iii.

more than +/"hope" myfile.txt

Brandish the contents of file myfile.txt, beginning at the first line containing the string "hope".

ls | more

Listing the contents of the electric current directory with ls, using more to display the listing one screen at a time.

cat — Output the contents of a file.
csh — The C shell command interpreter.
ctags — Create tag files for source code.
less — Scrolling text viewer.
man — Brandish the transmission page of a given command.
nroff — Format documents for terminal display or line-printer.
script — Tape everything printed on your screen.
sh — The Bourne beat command interpreter.
ul — Translate underscores to underlining.