Saturday, July 08, 2006

Linux meta-Help

I wanted to write this article for a long time. Today i have finally made my mind of inking it. When i try out something new, first thing i do is learn how to access the help system of that application. Here i would like to explore some well known ways of getting help in linux.
  1. If you are in a shell and want to know the usage of a command you can do so by passing it "--help" option. This lists various options that can be passed to the command and its expected behaviour. Its purpose is to give a brief description of the command and list its most frequently used options. It is not exhaustive documentation.
  2. To know more about the command you can look at its manual page. Easiest way to view the manual (man) page is by using the man command. As the name suggests this is like a manual of the command. It lists out all possible options that can be used with the command and its expected behaviour. But man pages are not very straightforward to follow. For newbies, man pages are often intimidating. They usually do not provide example usages of the command. However they serve the purpose of being precise and exhaustive manual of the program/utility/function they are documenting.
  3. To get saner and user friendly documentation we can check the command's info page. Usually info pages are more informative than manual pages. The biggest advantage of info pages is that they usually include example usage of the command. They also have hyperlinks, so we can jump from one info page to another, getting a clear understanding of the related terms. A command's info page can be accessed using the info command.
Now given a command we know how to use it. What if we want to do something and don't know which command to use? Most of us frequently face this problem.
  1. Google. Ah, the obvious choice to find any unknown. There is also a linux specific google search channel which can be tried. You may find solutions to your problem in either a forum, mailing list or documentation/howto site.
  2. What if you don't have access to internet (highly improbable)? Anyways, in that can use the apropos command. It searches through manual descriptions of all the commands. This way we can find out the correct command to solve our problem.
  3. whatis is another useful command. It gives short (usually one line) description of the command. Infact the apropos command internally uses the whatis database.
Some handy ways to access these help systems from other applications:-
  1. From vim you can directly open man page of a command/function used by pressing 'K' on it.
  2. konqueror has defined man and info protocols. So from konqueror we can view an info/man page of a command by typing info:command and man:command respectively. These html pages are generated using the info2html utility.
Some related links:-
  1. About MAN pages
  2. Linux MAN pages online
  3. The Linux Documentation Project
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.