Finding Help in Linux
Linux is chock-full of documentation, the challenge however is knowing where to find that documentation. One of the first things that every Linux user ought to learn is how to view the manual pages, man <command>
, but there is more to know. The man pages are divided into 9 sections:
- Executable programs or shell commands
- System calls (functions provided by the kernel)
- Library calls (functions within program libraries)
- Special files (usually found in /dev)
- File formats and conventions eg /etc/passwd
- Games
- Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)
- System administration commands (usually only for root)
- Kernel routines [Non standard]
When viewing a man page you can see what section you are in by looking at the top corners. If the program has content in multiple sections, you can view them with man <number> <command>
.
Man pages are typically stored in /usr/share/man/
but you can verify the path on your system by running manpath
. You can also run whereis <command>
to find the exact path for the command and corresponding man page on your system. While it is rarely needed, you can run mandb
to force the man page index caches to be updated; this is useful if man cannot find the man page for a newly installed program.
If you have an idea about what you are looking for but you do not know the relevant command, you can search through all of the man page descriptions two different ways: apropos <search_term>
or man -k <search_term>
. Either will achieve the same goal.
You can also use compgen -c
to see a full list of all programs in your path. See an interesting looking command and want a brief description of what it is? Simply run whatis <command>
.
Last but not least, I want to mention how you can find information about the Linux directory structure, i.e. the file system hierarchy. Simply run man hier
to get a full description of the structure and what is stored in each location.
Beyond the man Pages
Most programs will install additional documentation and configuration examples in /usr/share/doc
. If you are looking for examples and/or configuration advice it might be worthwhile to run grep -Ri <keyword> /usr/share/doc
.
As an added bonus, if you are interested in mastering the vim editor, peruse vimtutor
!