less (view file by pages)

This command is a so-called pager. It displays a file one page at a time. Sure, this can also be done with a text editor, but if you don't want to change the file anyway, firing up less tends to be quicker and safer because you cannot make any accidental changes. Morever, on most desktop systems the →man command uses less to display manual pages, so you should become familiar with the pager in any case. I use less like this:

less -M file.txt

The -M option makes less display a verbose prompt giving detailed information about the page in view, for example:

file.txt lines 20-60/183 32%

This prompt tells me that file.txt has 183 lines and I'm viewing lines 20 to 60, which means that I have scrolled 32% into the file. Because I always want a verbose prompt, I keep the following →alias definition in my ~/.bashrc configuration file:

alias less=`less -M'

Although you can use the mouse wheel to scroll around in less, using the keyboard is much quicker. Ctrl-f scrolls one page forward and Ctrl-b takes you one page back. The keys j and k scroll forward and backward one line respectively. Press lower-case g to jump to the beginning of the file and upper-case G to go to the end. If you're a touch typist, you can navigate files with less at lightning speed without ever lifting your hands off the keyboard's home row. The h key (“help”) will display the full list of key bindings. Press q to quit less.