The utilities introduced in this chapter and Chapter 2 constitute a small but powerful subset of the many utilities available on a typical Linux 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 45)
Displays the differences between two files (page 51)
Displays information about the contents of a file (page 52)
Searches file(s) for a string (page 48)
Displays the lines at the beginning of a file (page 49)
Displays a list of jobs in the print queue (page 47)
Places file(s) in the print queue (page 47)
Removes a job from the print queue (page 48)
Renames a file or moves file(s) to another directory (page 46)
Puts a file in order by lines (page 50)
Displays the lines at the end of a file (page 49)
Displays the contents of a file, skipping successive duplicate lines (page 51)
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, such as most text files, but reduces the size of almost all files. The inverse of bzip2 bunzip2 restores 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 57)
Displays a file compressed with bzip2 (page 57)
Compresses a file (page 56)
Compresses a file (not as well as gzip) (page 58)
Returns a file compressed with gzip or compress to its original size and format (page 58)
Compresses a file (page 58)
Displays a file compressed with gzip (page 58)
An archive is a file, usually 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 58)
The utilities listed in Table 3-5 determine the location of a utility on the local system. For example, they can display the pathname of a utility or a list of C++ compilers available on the system.
Table 3-5. Location utilities
Searches the man page one-line descriptions for a keyword (page 62)
Searches for files on the local system (page 63)
Displays the full pathnames of a utility, source code, or man page (page 61)
Displays the full pathname of a command you can run (page 61)
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 information maintained by the system.
Table 3-6. User and system information utilities
Displays detailed information about users, including their full names (page 64)
Displays detailed information about users who are logged in (page 66)
Displays information about users who are logged in (page 64)
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 (page 68)
Sends a message to another user who is logged in (page 67)
Table 3-8 lists miscellaneous utilities.
Table 3-8. Miscellaneous utilities
Displays the current date and time (page 54)
Copies its arguments (page 861) to the screen (page 53)