The more command in Linux is used to view the contents of a text file one screenful at a time. It allows you to scroll through the file interactively, viewing the file page by page. Unlike less, more does not support backward scrolling or advanced features, making it a simple and straightforward pager for text files.
The basic syntax of the more command is:
Bash
more [options] fileWhere:
fileis the name of the text file you want to view usingmore.
Here is a table of the more command’s parameters:
| Parameter | Description |
|---|---|
-b | Bypass the built-in binary file detection. |
-c | Continuously scroll the output. |
-d | Display the file name at the bottom of the screen. |
-f | Force more to treat the input as a text file. |
-H | Display the help message. |
-i | Ignore case when searching. |
-n | Number the lines. |
-s | Squeeze multiple blank lines into a single blank line. |
-S | Skip lines that match a regular expression. |
Examples:
- Display the file
file.txtone screen at a time:
Bash
more file.txt- Continuously scroll the output of the file
file.txt:
Bash
more -c file.txt- Display the file name at the bottom of the screen for the file
file.txt:
Bash
more -d file.txt- Ignore case when searching the file
file.txt:
Bash
more -i file.txt- Number the lines of the file
file.txt:
Bash
more -n file.txt- Squeeze multiple blank lines into a single blank line in the file
file.txt:
Bash
more -s file.txt- Skip lines that match the regular expression
^.*foo.*$in the filefile.txt:
Bash
more -S '^.*foo.*$' file.txtThe more command is a powerful tool that can be used to view text files. By understanding the different parameters that the more command can take, you can use it to view text files effectively.