more - macOS
Overview
more is a command-line utility in macOS that allows you to view the contents of a file or input stream one page at a time. It’s particularly useful for paging through large text files or output from other commands.
Syntax
more [options] [file]
Options/Flags
- -d: Display line numbers.
 - -n [number]: Specify the number of lines to display per page (default: 24).
 - -s: Squeeze multiple blank lines together.
 - -u: Display all lines, including empty ones. By default, more skips empty lines.
 - +N: Skip to the Nth line of the file.
 - -C: Check if the file has been modified since it was last viewed. If it has, more will display the file again from the beginning.
 - -f: Force more to display the file even if it has not been modified since the last time it was viewed.
 
Examples
- Simple usage: Display the contents of a file one page at a time:
 
more myfile.txt
- Skip to a specific line: Skip to line 100 in a file:
 
more +100 myfile.txt
- Display line numbers: Display line numbers along with the text:
 
more -d myfile.txt
- Specify number of lines per page: Display 50 lines per page:
 
more -n 50 myfile.txt
- Suppress blank lines: Remove consecutive blank lines from the output:
 
more -s myfile.txt
Common Issues
- File not found: Ensure that the specified file exists and is readable.
 - Empty file: If the file is empty, more will display a message and exit.
 - File modified: If the file has been modified since the last time it was viewed, more may not display the correct contents. Use the 
-Cflag to force more to re-read the file. 
Integration
More can be used in conjunction with other macOS commands to enhance its functionality. For example:
head -n 10 myfile.txt | more
This command pipes the first 10 lines of myfile.txt to more, allowing you to view them one page at a time.