Once you have Linux installed and running, the most important piece of information you need is how to get help. There are megabytes of documentation right there on your Linux system that can answer all of your questions, if you just know how to access it!
help CommandYou might expect the command "help" to be the universal way to get
assistance, but this isn't true on Linux. The help command is internal
to the bash shell, and can only tell you about the shell's internal
commands. These include cd and echo
(but not ls!), as well as job
control commands like bg and jobs. Typing
help without any parameters prints a list of things that
it can help you with. To get help on a particular command, type help
command. For example, to get help on the echo command, type:
help echo
man PagesThe standard way to get help, which works on any UNIX system, is a command called man (think "manual", as in user handbook). To get help on the grep command, for example you would type:
man grep
This displays a help screen describing the program and its usage. Man
pages, as they are known, are formatted on the fly from special source
files, and are displayed using the program less.
less is a simple display program similar to
more (less is more, get it?), allowing you to view files
that are longer than a
single terminal screen, but it allows more liberty in scrolling. You can
scroll back and forth line by line with the arrow keys or whole
screens using the PgUp and PgDn keys. When you're done reading,
press Q to quit (the escape key will
not get you out of less) and you'll
get back to the command prompt.
Man pages are stored in a categorized database. These are the standard categories:
Sometimes you will need to know this in order to find the man page
you are looking for. For example, there is a user command
passwd that can be used to change your login password. If
you type man passwd you will get the man page for this
command, since it is in section 1. However, there is also a file
called passwd that stores the password database on your
system. The format for this file is explained in a man page in section
5, File Formats. To get to it, you need to type man 5
passwd so the man command will look in section 5 rather than
starting at section 1.
Man pages are often very detailed and might tell you far more than
you wanted to know. If you just want a quick idea of what a command
does, use the whatis command. For example, whatis
grep returns:
grep, egrep, fgrep (1) - print lines matching a pattern
This shows you that grep, and its related commands
egrep and fgrep, have man pages in section
1, and are used to "print lines matching a pattern." If you were
searching for a command to copy files, you would know that this isn't
it and you could move on. Or you could consult the man page for
details on using these commands.
Related to the whatis command is apropos,
which searches the whatis database for keywords. If you know what you
want to do but don't know the command, apropos will give
you list of related commands. For example, if you want to copy files,
try apropos copy and get:
bcopy (3) - copy byte strings copy (l) - copy data to/from a class from/to a Unix file. copysign (3) - copy sign of a number cp (1) - copy files cpio (1) - copy files to and from archives dd (1) - convert a file while copying it dvicopy (1) - produce modified copy of DVI file fcopy (n) - Copy data from one channel to another.
Your list will probably be much longer than this, but by reading
through it you will find that the command you want is cp
for copying files.
If the apropos and whatis commands don't
work on your system, it may mean that the whatis database has not been
created, or is corrupt. You can rebuild it by running
/usr/sbin/makewhatis as SuperUser. Note that the
apropos command will accept only one parameter. You
cannot search for multiple keywords. If you try, only the first will
be used. The whatis command will accept multiple search
words, but searches for them individually rather than as a group (in
other words, combining them with OR rather than AND).
infoMany of the utilities included with Linux, especially those created by the GNU Project, have documentation in the form of info pages. Info pages look similar to man pages, but there is a lot more to them. Like the man pages, info documents are intended to act as your online "manual", your guide to the GNU/Linux system. But info documents are integrated with each other in a hypertext database that can be read like a book (it even has a table of contents) and accessed from your terminal.
Where both man pages and info pages exist, the info documentation is probably more accurate. To get info on the grep command, type:
info grep
The info viewer looks and behaves much like GNU Emacs. Most of the emacs key combinations will work in the info viewer. If you aren't familiar with emacs, you should probably get familiar with it, as its control keys and syntax are inescapably emulated by hundreds of Linux programs. (See Introduction to XEmacs for a basic tutorial and list of commands).
Navigating info documentation isn't terribly complicated, nor is it completely intuitive. Thankfully, there is a self teaching tutorial included with the package. At any time you can type a question mark (?) or Control-h to access a list of available commands, in case you need help with the navigation keys. Typing "h" by itself takes you to the info tutorial, the first few pages of which should tell you all you need to know for simple operation. The keys to remember are <SPACE> to page forward, <DELETE> to page backward, and <ENTER> to activate a hyperlink. (Links are normally preceded by an asterisk). "L" takes you to the Last node (page) visited, like the "Back" button in your web browser.
Many programs are just too complex to store all their help information in a man page. The /usr/doc directory is where these programs will store their information. Sometimes there will just be a text file, sometimes a program will have an entire subdirectory devoted to it. Also in this folder you may find copies of the Linux How-To's to help you with common tasks. Take these with a grain of salt. The information in the How-To's is usually very technical and oriented more toward system administrators than novice users. (Part of the purpose of Control-Escape is to translate some of that knowledge into plain English).
Check for a folder called HTML here. If you find it, open up your web browser of choice and use it to view the documentation. You will feel much more comfortable, I'm sure. I did.
The LDP is your best and most complete source for Linux information. I don't think a day goes by that I don't visit them for something. Make sure to check their mirrors for one close to you to save bandwidth on their server.
© Copyright 1998-2010 by Vincent Veselosky.
Unless otherwise noted, the text content of this work is licensed under the Creative Commons Attribution-Share Alike 2.5 License.
Please see the Control-Escape License page
for details.