Professional Documents
Culture Documents
In this appendix, you find the commands listed by themes, according to what
they can actually do for you. So read on — and dazzle your friends with your
command-prompt finesse. When they ask you how and where you figured out
all those commands, just smile and mumble something about the voices in
your head — and, of course, keep this section dog-eared and within reach of
your computer.
Getting help
When you’re digging around for help on a command, you can call on an inter-
esting range of shell commands for assistance, as shown in Table A-1.
If you try to view the man page entries for some of these commands, you find
instead that the help information for BASH BUILTINS appears. To search
through this manual, press the forward slash (/) key to open the man search
interface — and then type the name of the command you want to search for.
412 Part VI: Appendixes
Press Enter to start the search. The interface stops in the first spot where the
term is found. If you want to try again, press the N key to proceed to the next
occurrence of the word.
For example, you might be reading the massive bash man page (type man
bash to access this page), but perhaps you’re only interested in items
related to prompts, which are the bits of text that appear to the left of your
cursor in a text window. An example prompt is
rich@textbox:~$
You might type /prompt and press Enter to jump to the first instance of this
word. If the text around the word doesn’t reflect what you’re looking for,
press the N key to jump to the next one, and so on.
File organization
Boxing, packing, sorting, shipping — you’re probably always shuffling files
around on your system. File organization commands provide tools for
moving files and filesystem units around, as shown in Table A-4.
File attributes
Files are much like candy bars: The wrappers provide information about
the ingredients, size, and package date — all descriptive of the tasty nugget
inside. (Perhaps the wrapper is even childproof.) Files keep all this wrapper
information in an inode. Along with the capability to change the file inode
information, file-attribute commands can return data about the content of the
file, as shown in Table A-5.
File locators
Where, oh, where can your file be? File-locator commands, shown in Table
A-6, help you locate files in Linux’s monster tree-structure filesystem.
414 Part VI: Appendixes
File viewers
Text-file browsing is a favorite pastime of many a system user. These tools
provide a variety of utilities for viewing the contents of readable text files
of all sizes. Unlike the commands in a full-screen editor, none of these com-
mands (shown in Table A-7) can damage the contents of a file. That’s because
they’re just viewers, not editors.
Filesystem commands
Filesystem commands, listed in Table A-8, provide information or perform
actions on the entire filesystem, from creation and tuning to repair and
recovery. Some of these commands return data only, whereas others also
provide you with surgical instruments for serious filesystem hacking.
Appendix A: Common Linux Commands 415
Table A-8 Filesystem Commands
Command Purpose
badblocks Searches a partition for bad blocks.
e2fsck Checks and repairs an ext2 or ext3 filesystem.
e2label Applies a filesystem label to an ext2 or ext3 partition.
eject Ejects a CD or DVD.
fsck Can check and repair many types of filesystems.
mkfs Creates a filesystem (format a partition).
mount Loads a partition into your filesystem.
sync Saves all information out of buffers onto disks.
tune2fs Adjusts ext2 and ext3 filesystem parameters.
umount Removes a partition from the filesystem.
mtools
The mtools suite of utilities provides a nice way to transfer information
to your Microsoft friends. Although Linux has native support for Microsoft
Windows and DOS filesystems, your Microsoft cohorts don’t have access to
Linux (ext2 and ext3) filesystems. To keep everyone happy, you can buy
preformatted MS-DOS discs and use them with the mtools commands (see
Table A-9) so you can swap files with your friends who are using Windows.
System Control
These commands provide system-wide information and control. Normal
users can run many commands to obtain system information; however, com-
mands that actively change the configuration of the system need to run while
you are logged in as root — or have utilized the su command to become the
superuser temporarily.
Administration
Some administration commands (shown in Table A-10) don’t fall neatly into a
category.
Processes
Most of your system activity requires processes. Even when your system
appears idle, a dozen or so processes (programs) are running in the back-
ground. The process commands, shown in Table A-12, enable you to check
under the hood to make sure that everything that should be running is run-
ning — and that you’re not overheating or overtaxing your computer’s
resources.