Datasheet
Book VIII
Chapter 1
. . . And UNIX Lurks
Beneath
691
UNIX Programs That Come in Handy
to another one that follows — for example, many UNIX commands produce
large amounts of information that can’t all fit on one page. (You might have
noticed this behavior when you used the locate command.) Joining two
commands or functions together with the pipe command is piping. To tame
the screens full of text, pipe the find function to the less command. The
less command provides data one page at a time.
find ~/ -name “Fonts” | less
When the results fill up one page, the data stops and waits for you to press
any key (except the Q key) to continue. When you reach the end of the
results, press Q to quit and return to a command-line prompt.
UNIX Programs That Come in Handy
As a Macintosh user, you might be surprised to know that many applications
on your hard drive don’t reside in one of the typical Applications folders of
Mac OS X. These applications, in fact, don’t have any graphical user inter-
face like what you’re accustomed to. They’re accessible only from the com-
mand line. The remainder of this chapter covers some of these applications.
Text editors
UNIX has many text-editing applications for use at the command line. Some
of the more popular ones include nano, vi, and emacs. Each of these text
editors has its pros and cons — and say thanks to the thorough folks at
Apple, because all three are included with Lion! For my examples here, how-
ever, I use nano because it’s simple to use and sufficient for our needs.
Creating a new document
To create a text file by using nano, simply type nano at the command line.
The result looks like Figure 1-7.
Figure 1-7:
The
nano
program
is a full-
strength text
editor, right
from the
command
line.
55_9781118022061-bk08ch01.indd 69155_9781118022061-bk08ch01.indd 691 8/10/11 9:39 AM8/10/11 9:39 AM