Datasheet
Book VIII
Chapter 1
. . . And UNIX Lurks 
Beneath
687
Useful Commands
  Once again, deleting files and folders requires that you have permission to 
do so. In other words, any time that you manipulate files with the command 
line, you’re required to have the proper permission. If your current user 
lacks these permissions, using sudo helps. You should also check to make 
sure that your target is correctly spelled and that no pesky spaces that 
could wreak carnage are lurking in the command.
Opening documents and launching applications
Launching applications and opening documents is child’s play for a UNIX 
pro like you. The open command does it all. For example, to bring the Finder 
to the foreground without touching the mouse, use
open /System/Library/CoreServices/Finder.app
To open a document from the command line, follow a similar scheme. 
For example, to view an image named myImage.tif that’s stored in your 
Documents folder, try this:
open ~/Documents/myImage.tif
Useful Commands
Manipulating files and viewing folder content is fun, but the command line is 
capable of so much more! Now I focus your attention on some of the other 
useful tasks that you can perform with the command line.
Mac OS X comes stocked with a full set of useful commands. You can dis-
cover many of the commands that are installed by viewing the files in /usr/
bin. Type cd /usr/bin to navigate there. Other locations to peruse include /
bin and /usr/local/bin.
Calendar
One of my favorite command-line functions is the cal command, which dis-
plays a calendar in text form. Simply entering cal at the prompt displays a 
calendar for the current month, as shown in Figure 1-4.
Append a number to the cal command to display a 12-month calendar for 
that year. The number that follows the cal command is the year for which 
you’d like to see a calendar. For example, to view a calendar for 1970, type 
cal 1970. The result appears in Figure 1-5.
55_9781118022061-bk08ch01.indd 68755_9781118022061-bk08ch01.indd 687 8/10/11 9:39 AM8/10/11 9:39 AM










