File Pagers
There are several command-line utilities to review the contents of a file in Enterprise Linux. These include:
more
- The most traditional pager in Linux. The user presses “Space” to move through a file using
more
. Standard search functionality (/
) works similar to how it does inman
pages orvim
- Typical Usage:
more myFile.txt
cat myFile.txt | more
- less efficient but commonly used
- The most traditional pager in Linux. The user presses “Space” to move through a file using
less
- Built to address the shortcomings of
more
,less
has additional features such as scrolling via arrow keys (as well as “Space”) and the same search functionality (/
). Generally preferred by most users. - Typical Usage:
less myFile.txt
cat myFile.txt | less
- less efficient but common used
- Built to address the shortcomings of
view
- A “read-only” mode for the
vim
editor. - Has all the same functionality as
vi
orvim
- users can search the document, move the cursor to the beginning/end of lines or the document itself. - User can even modify the document, but cannot save it without the
!
flag (and appropriate file permissions of course) - Typical Usage:
view myFile.txt
- A “read-only” mode for the
cat
- Most basic way to view a file in CLI
- Not really a file pager, but used to view short files effectively. Returns the entire contents of the file to the terminal - so less useful for larger files.
- Often used in conjunction with pipes - helps to get the entire contents of a file passed to the next command
- Typical usage:
cat myFile.txt
cat myFile.txt | grep -v 'notLinesWithThisText'