more command
more
- A file perusal filter for crt viewing
The more
command in Linux is a utility used to view file contents in the terminal, one page at a time. It’s simpler than less
but still useful for reading files without flooding your screen.
Usage: more [OPTION]... [FILE]...
OPTION
: Flags which enhances themore
abilities.FILE
: The file you want to view.
Examples
-
Opening a File and Navigating
To view a file, pass its name to
more
.$ more logfile.txt
-
Displays logfile.txt one screen at a time.
-
A percentage (e.g., --More--(23%)) shows your position in the file.
Key Action Space
Scroll down one page Enter
Move down one line b
Scroll back one page (if supported) -d
Show helpful prompts (e.g., "Press space to continue") -n
Set the number of lines per page (e.g., -n 10) -s
Squeeze multiple blank lines into one q
Quit more
/pattern
Search for "pattern" +/pattern
Start at the first occurrence of "pattern" +num
Start at line number "num" (e.g., +50) -
Unlike
less
,more
doesn’t let you freely scroll up in all implementations. Some versions supportb
for backward movement, but it’s not universal
$ more +50 logfile.txt
- Starts displaying
logfile.txt
from line 50.
$ more +/error logfile.txt
- Opens
logfile.txt
at the first instance of "error".
-
-
Searching in a File
Search for text by typing
/
followed by your pattern.$ more logfile.txt
# after file opens use /error
/error- Type
/error
and pressEnter
to jump to the next occurrence of "error". - Press
n
to find the next match.
- Type
-
Viewing Multiple Files
You can pass multiple files to
more
and switch between them.$ more file1.txt file2.txt
- Opens
file1.txt
first. - After reaching the end, press
:
and thenn
(or justEnter
) to move tofile2.txt
.
- Opens
-
Piping Input
Use
more
to paginate command output.$ ls -l | more
- Displays the directory listing one page at a time.
To get help related to the more
command use --help
option
$ more --help
Usage:
more [options] <file>...
A file perusal filter for CRT viewing.
Options:
-d, --silent display help instead of ringing bell
-f, --logical count logical rather than screen lines
-l, --no-pause suppress pause after form feed
-c, --print-over do not scroll, display text and clean line ends
-p, --clean-print do not scroll, clean screen and display text
-s, --squeeze squeeze multiple blank lines into one
-u, --plain suppress underlining and bold
-n, --lines <number> the number of lines per screenful
-<number> same as --lines
+<number> display file beginning from line number
+/<pattern> display file beginning from pattern match
-h, --help display this help
-V, --version display version