Viewing Linux Files the
more command
The more command allows viewing files too big to fit in a
single window by showing them one page at a time.
$ more
chapter1.txt
After the more commandis
executed, the first page is displayed. The bottom of the screen
shows a percentage of how far you are through the file that is
currently being viewed. Within more, moving forward or backward in
the file or searching for a string of text can be done. Here is a
quick reference for the more commands that are most likely to be
used:
Command |
Action |
h or ? |
Display help screen with a short summary of
common commands |
Space |
Display the next page of text |
b |
Go back one page of text |
Return |
Move one line forward in the file |
v |
Edit this file using the default editor |
control-l |
Redraw the current screen (useful when the
screen size has been changed) |
q |
Quit more and return to the command prompt |
Table 2.1: Common more Commands
While more only allows viewing the contents of a file, use the
v command to open this file in an editor. More about vi, the
default editor in Linux, will be shown later in this book.
Another popular command for viewing files is less. The less
command offers all the functionality of more, but with some
additional features, many that are geared specifically to
programmers. For most file browsing, more does everything that is
needed by it; however, if preferred, most of the more commands
will work in less.