LinuxCommandLibrary

more

View file contents, one screen at a time

TLDR

Open a file

$ more [path/to/file]
copy

Display a specific line
$ more +[line_number] [path/to/file]
copy

Go to the next page
$ <Space>
copy

Search for a string (press to go to the next match)
$ </>[something]<Enter>
copy

Exit
$ <q>
copy

Display help about interactive commands
$ <h>
copy

SYNOPSIS

more [options] [file ...]

PARAMETERS

-num
    Specifies the number of lines per screen. Defaults to the terminal height.

-d
    Displays prompt 'Press space to continue, 'q' to quit' and displays 'Press 'h' for instructions' instead of ringing the bell when an illegal key is pressed.

-l
    Treats the form feed character (Ctrl+L) as a normal character instead of clearing the screen.

-f
    Counts logical lines, instead of wrapping long lines.

-p
    Clears the screen before displaying each page.

-c
    Similar to -p, but scrolls by clearing each line instead of clearing the entire screen. Slower but avoids some screen flicker.

-s
    Squeezes multiple blank lines into a single blank line.

-u
    Suppresses underlining and bolding.

+num
    Starts displaying the file from line num.

+/string
    Starts displaying the file from the first occurrence of string.

DESCRIPTION

The more command is a Unix/Linux utility used to view the contents of a text file on the terminal, one screenful at a time. It allows users to navigate forward and backward through the file, search for specific strings, and perform other basic text manipulation tasks. Unlike cat, which displays the entire file at once, more pauses after each screen, preventing the text from scrolling off the screen and improving readability, especially for large files.

more is considered the predecessor to the less command, which offers more advanced features like reverse scrolling and pattern matching. While less is generally preferred and more commonly used today, more remains available on most Unix-like systems and is useful for simple file viewing needs. Its basic syntax is straightforward: more filename.

CAVEATS

more only supports forward scrolling and lacks many advanced features found in less. It's primarily useful for simple text viewing.

COMMAND MODE

While viewing a file, more provides several commands that can be entered:
q: Quit.
h: Help.
Space: Display the next page.
d: Display the next half page.
/pattern: Search for the pattern.
n: Repeat the previous search.

HISTORY

more was one of the original Unix pager programs, designed to address the problem of viewing large text files on early terminals with limited memory and display capabilities. It predates less and served as a fundamental tool for navigating and reading files. While less has largely superseded more due to its superior functionality, more remains a part of many Unix and Linux distributions for compatibility and historical reasons. Its development represents a crucial step in the evolution of text-based user interfaces.

SEE ALSO

less(1), cat(1), head(1), tail(1)

Copied to clipboard