How to Use More Command in Linux: Simple Guide
Use the
more command in Linux to view the contents of a text file one screen at a time. Run more filename to start, then press Space to see the next page or q to quit.Syntax
The basic syntax of the more command is:
more [options] filename
Here, filename is the name of the file you want to view. Options can modify how more behaves, like showing line numbers or starting at a specific line.
bash
more filename.txt
Example
This example shows how to use more to read a file named example.txt. It displays the file content one screen at a time. Press Space to move to the next page and q to exit.
bash
more example.txt
Output
This is line 1 of example.txt
This is line 2 of example.txt
...
--More--
Common Pitfalls
Common mistakes when using more include:
- Trying to scroll up:
moreonly scrolls forward, not backward. - Not quitting properly: Press
qto exit, notCtrl+C. - Using
moreon binary files: It may show unreadable characters.
For backward scrolling, use less instead.
bash
more binaryfile # Wrong: trying to scroll back # Right: use less binaryfile
Quick Reference
| Command | Description |
|---|---|
| more filename | View file content one page at a time |
| Space | Go to next page |
| Enter | Go to next line |
| q | Quit the more command |
| /pattern | Search forward for pattern |
Key Takeaways
Use
more filename to view text files page by page.Press
Space to move forward and q to quit.more scrolls only forward; use less for backward scrolling.Avoid using
more on binary files to prevent unreadable output.You can search forward in the file by typing
/pattern while viewing.