The less command allows you to view the contents of text files and other data in page mode.
I will describe the control keys:
up arrow (Move one line up)
down arrow (Move one line down)
PageUp (Move one page up)
PageDown or SPACE (Move one page down)
ENTER (Move one line down)
d (Move half a page down)
b (Move one page up)
g (move to beginning of file)
shift+g (move to end of file)
/text/ (Search for the specified text forward)
?text? (Search the specified text back)
:n (next file)
:p (previous file)
:d (close the current file)
shift+f (allows you to view new lines in real time, similar to tail -f)
ctrl+c (disabling newline browsing)
v (run editor)
h (Help)
q (Exit)
An example of a simple file view:
less FILENAME.log
View starting at line 5:
less +5 FILENAME.log
Search for the specified text in the file:
less +/text FILENAME.log
Viewing multiple files:
less FILENAME.log FILENAME2.log FILENAME3.log
You can redirect the output of a command to less to conveniently view the contents in page mode.
For example from cat to less:
cat FILENAME.log | less
View directory contents:
ls -al /etc | less
Archive content:
tar -ztf FILENAME.tar.gz | less
tar -jtf FILENAME.tar.bz2 | less
Search results for ssh text in auth.log file:
tac /var/log/auth.log | grep ssh | less
Etc.