|
|
The more command displays a file one screen at a time. If the file fits on one screen, more quits and you are returned to the prompt. If the file is more than one screen long, more displays a prompt at the bottom of the screen showing what percentage of the file you have already read. Press <Space> to see another screen of the file. (You can use <Enter> to see another line of the file.) To quit more without reading the whole file, type q.
The more command lets you search for words in a
file by typing a slash (/). Type a ``/'', then type
the word or words you want to search for at the /
prompt at the bottom of the screen. more skips
to the next page of the file where those words occur.
more can only search forward; if the words you
are searching for come before where you currently are in
the file, more cannot find them.
Try reading through the file /etc/passwd (a file that stores a variety of information about users on the system) to find your login name:
/
prompt at the bottom of the screen and press <Enter>.
More
prompt at the bottom of the screen,
press q to quit more.
Q: more seems much better than cat; is there any reason I should use cat instead?
A:
cat can be better than more in some
instances. If you want to look at a short file,
cat is probably better because it does not waste
time loading the file into a buffer and then paging it out
on the screen. Also, cat is more forgiving about
what it displays.
more cannot display files containing control
characters (it gives you the error message Not a text
file
), whereas cat tries its best to display
any file.