more Command

View file contents page by page, allowing easy navigation through large text files.

Syntax

more [OPTIONS] [FILE...] command | more

The more command displays text files one screen at a time, pausing after each screenful and waiting for user input to continue.

Common Options

Option Description
-d Display help message at bottom of screen
-f Count logical lines rather than screen lines
-l Do not pause after form feed character
-p Clear screen before displaying each page
-c Clear screen before displaying each page (same as -p)
-s Squeeze multiple blank lines into one
-u Suppress underlining
+num Start displaying from line number

Navigation Keys

Basic Navigation
  • Space - Next page
  • Enter - Next line
  • b - Previous page
  • q - Quit
  • h - Help
  • = - Show current line number
  • /pattern - Search forward
  • n - Next search result
  • v - Start vi editor
  • ! - Execute shell command
  • . - Repeat previous command
  • Ctrl+L - Refresh screen

Basic Examples

Viewing files

# View a single file more filename.txt # View multiple files more file1.txt file2.txt file3.txt # View file starting from specific line more +50 largefile.txt # View file with line numbers displayed more -d filename.txt

Basic file viewing with the more command

Using with pipes

# Page through command output ls -la | more # Page through process list ps aux | more # Page through log files cat /var/log/syslog | more # Page through directory listing find /usr -name "*.conf" | more

Use more to page through command output

Display options

# Clear screen before each page more -p filename.txt # Squeeze multiple blank lines more -s filename.txt # Suppress underlining more -u filename.txt # Count logical lines more -f filename.txt

Customize display behavior with options

Advanced Usage

Search functionality

# While in more, search for text /search_term # Search forward for "search_term" n # Go to next occurrence # Search examples /error # Find "error" in the file /^Chapter # Find lines starting with "Chapter" /[0-9]+ # Find lines containing numbers

Search for specific content within files

Interactive commands

# While viewing file in more: h # Show help = # Show current line number v # Edit current file with vi !command # Execute shell command . # Repeat last command # Navigation shortcuts 10 Space # Skip 10 pages forward 5 Enter # Skip 5 lines forward 3b # Go back 3 pages

Interactive commands available within more

Multiple file handling

# View multiple files sequentially more *.txt # While viewing multiple files: :n # Go to next file :p # Go to previous file :f # Show current filename # Skip to specific file more file1.txt file2.txt file3.txt # Then use :n to navigate between them

Handle multiple files efficiently

Practical Examples

Log file analysis

# View system logs more /var/log/syslog # View Apache access logs more /var/log/apache2/access.log # View kernel messages dmesg | more # View authentication logs more /var/log/auth.log # Search for errors in logs grep -i error /var/log/syslog | more

Use more for log file analysis and troubleshooting

Configuration file review

# View configuration files more /etc/nginx/nginx.conf more /etc/ssh/sshd_config more /etc/fstab # View with line numbers for reference nl /etc/hosts | more # View multiple config files more /etc/*.conf

Review configuration files safely

Documentation reading

# Read README files more README.md more INSTALL.txt # View manual pages through more man ls | more # Read documentation files more /usr/share/doc/*/README* # View changelog files more /usr/share/doc/*/changelog*

Read documentation and text files comfortably

Comparison with Other Pagers

more vs less

more:

  • Simpler, forward-only navigation
  • Exits automatically at end of file
  • Limited search capabilities
  • Smaller memory footprint
  • Available on all Unix systems

less:

  • Bidirectional navigation
  • Stays open at end of file
  • Advanced search features
  • More interactive commands
  • Better for large files
When to use more
  • Simple file viewing needs
  • Limited system resources
  • Compatibility with older systems
  • Quick file previews
  • Scripting environments
  • When less is not available

Command equivalents

# more alternatives more filename.txt less filename.txt # More features cat filename.txt # Show all at once head filename.txt # Show first lines tail filename.txt # Show last lines # Paging command output command | more command | less # Better for large output command | head # First lines only command | tail # Last lines only

Alternative commands for different viewing needs

Environment Variables

Customizing more behavior

# Set default options for more export MORE="-d -s" # Set terminal type export TERM=xterm-256color # Set lines per page export LINES=30 export COLUMNS=80 # Example .bashrc configuration echo 'export MORE="-d -s -p"' >> ~/.bashrc source ~/.bashrc

Configure more behavior through environment variables

Troubleshooting

Common Issues
  • Binary file display - more shows garbled text for binary files
  • Terminal size issues - Incorrect page sizing
  • Encoding problems - Non-ASCII characters display incorrectly
  • Stuck in more - Cannot exit or navigate

Solutions and workarounds

# Check if file is binary before using more file filename.txt # Force quit if stuck Ctrl+C # Interrupt more q # Quit normally # Fix terminal size issues resize # Update terminal size stty size # Check current size # Handle encoding issues export LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8 # Use alternative for binary files hexdump -C filename.bin | more od -c filename.bin | more

Resolve common issues with more command

See also