The utilities introduced in this chapter and Chapter 2 are a small but powerful subset of the utilities available on a Mac OS X system. Because you will use them frequently and because they are integral to the following chapters, it is important that you become comfortable using them.
The utilities listed in Table 3-2 manipulate, display, compare, and print files.
Table 3-2. File utilities
Copies one or more files (page 43)
Displays the differences between two files (page 49)
Copies files and directories (page 44)
Displays information about the contents of a file (page 50)
Searches a file for a string (page 46)
Displays the lines at the beginning of a file (page 47)
Displays a list of jobs in the print queue (page 46)
Places file(s) in the print queue (page 45)
Removes a job from the print queue (page 46)
Renames file(s) or moves file(s) to another directory (page 45)
Opens a file (page 42)
Records a shell session (page 52)
Puts a file in order by lines (page 49)
Displays the lines at the end of a file (page 48)
Displays the contents of a file, skipping successive duplicate lines (page 49)
To reduce the amount of disk space a file occupies, you can compress it with the bzip2 utility. The compression works especially well on files that contain patterns, as do most text files, but reduces the size of almost all files. The inverse of bzip2bunzip2restores a file to its original, decompressed form. Table 3-3 lists utilities that compress and decompress files. The bzip2 utility is the most efficient of these.
Table 3-3. (De)Compression utilities
Returns a file compressed with bzip2 to its original size and format (page 55)
Displays a file compressed with bzip2 (page 55)
Compresses a file (page 54)
Compresses a file (not as well as gzip) (page 55)
Returns a gzipped or compressed file to its original size and format (page 55)
Displays a compressed file (page 55)
Compresses a file (page 55)
An archive is a file, frequently compressed, that contains a group of files. The tar utility (Table 3-4) packs and unpacks archives. The filename extensions .tar.bz2, .tar.gz, and .tgz identify compressed tar archive files and are often seen on software packages obtained over the Internet.
Table 3-4. Archive utility
Creates or extracts files from an archive file (page 56)
The utilities listed in Table 3-5 determine the location of a utility on your system. For example, they can display the pathname of a utility or a list of C++ compilers available on your system.
Table 3-5. Location utilities
Searches the man page one-line descriptions for a keyword (page 59)
Locates a utility (page 58)
Displays the full pathname of a command you can run (page 58)
Table 3-6 lists utilities that display information about other users. You can easily learn a user's full name, the user's login status, the login shell of the user, and other items of information maintained by the system.
Table 3-6. User and system information utilities
Displays detailed information about users who are logged in, including full names (page 61)
Displays your system name (page 43)
Displays detailed information about users who are logged in (page 62)
Displays information about users who are logged in (page 60)
The utilities shown in Table 3-7 can help you stay in touch with other users on the local network.
Table 3-7. User communication utilities
Permits or denies messages sent by write or talk (page 64)
Sends a message to another user who is logged in (page 63)
Table 3-8 lists miscellaneous utilities.
Table 3-8. Miscellaneous utilities
Displays the current date and time (page 52)
Copies its arguments (page 921) to the terminal (page 52)