more

text processingLinux/Unix
The more command is one of the most frequently used commands in Linux/Unix-like operating systems. more Display file content one screen at a time

Quick Reference

Command Name:

more

Category:

text processing

Platform:

Linux/Unix

Basic Usage:

more [options] [arguments]

Common Use Cases

    Syntax

    more [options] [file...]

    Options

    Option Description
    -d Display "Press space to continue, 'd' to next half page, 'q' to quit" prompt
    -f Count logical lines rather than screen lines (for long lines)
    -l Ignore form feed (^L) characters for page breaks
    -c Clear screen before displaying each page
    -p Clear screen before displaying each file
    -s Squeeze: multiple blank lines displayed as one
    -u Suppress underlining
    +number Start displaying at line number
    +/pattern Start displaying at first occurrence of pattern
    -number Specify screen size in lines

    Key Commands While Viewing:

    Key Action
    Space Display next page
    Enter Display next line
    d or ^D Display half a page more
    b or ^B Go back one page
    = Display current line number
    :f Display current filename and line number
    /pattern Search forward for pattern
    n Search for next occurrence of pattern
    q or Q Quit more
    v Start an editor at current line (defaults to vi)
    h Display help screen

    Examples

    How to Use These Examples

    The examples below show common ways to use the more command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.

    # Basic Examples Basic
    more file.txt
    Display the contents of file.txt one screen at a time.
    ls -l | more
    Pipe the output of ls -l to more for paged display.
    # Advanced Examples Advanced
    more +10 file.txt Start displaying file.txt from line 10. more +/pattern file.txt Start displaying file.txt from the first occurrence of "pattern". more -5 file.txt Display file.txt with a screen size of 5 lines. more -d file.txt Display file.txt with a "Press space to continue, 'd' to next half page" prompt. more -c file.txt Clear the screen before displaying each page. more -p file1.txt file2.txt Clear the screen before displaying each file. more -s file.txt Squeeze multiple blank lines into one.
    cat file1.txt file2.txt | more
    View the concatenated content of multiple files.

    Try It Yourself

    Practice makes perfect! The best way to learn is by trying these examples on your own system with real files.

    Understanding Syntax

    Pay attention to the syntax coloring: commands, options, and file paths are highlighted differently.

    Notes

    The 'more' command is a fundamental text pager in Unix-like operating systems used to view the contents of text files or command output one screen at a time. It was one of the earliest pagers developed for Unix and remains available on virtually all Unix-like systems, though it has been largely superseded by the more advanced 'less' command in many modern distributions. Key features of the more command: 1. Screen-by-Screen Viewing: more allows users to browse through large text files or command outputs one screenful at a time, making it easier to read and navigate through extensive content. 2. Forward Navigation: The command primarily supports forward movement through files, allowing users to advance by one line, one screenful, or half a screen at a time. 3. Basic Searching: more includes simple search functionality, allowing users to find text patterns within the displayed content. 4. Command-Line Options: Various options allow customization of the display behavior, such as starting at specific lines, squeezing blank lines, or modifying the display format. 5. Pipeline Integration: more is commonly used at the end of command pipelines to paginate output from commands that produce extensive text results. 6. Visual Prompt: The command typically shows a percentage indicator at the bottom of the screen to indicate how far through the file the user has progressed. 7. Limited Editor Integration: In some implementations, more allows launching an editor (typically vi) to modify the file being viewed. Common use cases for more include: - Reading large text files that would otherwise scroll off the screen - Examining command outputs that generate multiple screens of text - Quickly scanning through log files or documentation - Reading manual pages in systems where 'man' uses 'more' as its pager - Viewing multiple files in sequence While more is still useful and available on all Unix-like systems, it has limitations compared to newer pagers like 'less'. The most significant limitation is that more generally only allows forward movement through a file (though some implementations support limited backward movement). The 'less' command, developed later, offers more features including bidirectional scrolling, better search capabilities, and doesn't require reading the entire file before starting to display it. Despite these limitations, more remains relevant due to its ubiquity, simplicity, and the fact that it's present on virtually every Unix-like system, making it a reliable tool for system administrators and users working across different environments.

    Related Commands

    These commands are frequently used alongside more or serve similar purposes:

    Use Cases

    Learn By Doing

    The best way to learn Linux commands is by practicing. Try out these examples in your terminal to build muscle memory and understand how the more command works in different scenarios.

    $ more
    View All Commands