Installation guide
112 Chapter 11. Shell Prompt Basics
Tip
To read startup messages more closely, at a shell prompt, type dmesg | less. You will be able to
read the file one screen at a time. To move forward, press the [Spacebar]; to quit, press [Q].
Pipes can also be used to print only certain lines from a file. Type:
grep coffee sneakers.txt | lpr
This will print every line in the sneakers.txt file that mentions the word "coffee" (read more about
grep in Section 11.11.3).
11.10.1. The more Command
The main difference between more and less is that more only lets you move forward through a file
and less lets you move backward and forward.
List the contents of the /etc directory using ls and more.
ls -al /etc | more
Figure 11-8. Piping Output of ls to more
Use the [Spacebar] to move forward through the pages. Press [q] to exit.
11.11. More Commands for Reading Text Files
You have already been introduced to several basic shell prompt commands for reading files in text
editors. Here are a few more.
11.11.1. The head Command
You can use the head command to look at the beginning of a file. The command is:
head
filename