Wednesday, 1 June 2011

Locate, read and use system documentation including man, info, and files in /usr/share/doc

Mastering this objective will make your life significantly easier.

Let's get started.

man man [.sic] will give you the manual page for the manual page, you have to love the Unix guys :)

In essence, just type man commandname to get the information about the command you need. The command man is really helpful as you can also get information about the configuration file for a service, e.g. man smb.conf will give you the manual page for the samba configuration file, or you can also get information about programming functions. Type q to exit the manual page.

man -k searchstring will display all man pages that contain the searchstring, using apropos
man -f searchstring will do the same, using whatis

One final thing is that you can use vi syntax to search a page manual, so you would do /searchstring and then press n to move to the next hit and N to the previous one. Note that this seems to be case insensitive by default as opposed to vi. In order to do a case sensitive search you can do /\CSearchString.

Note that if you want to look for a particular word, rather than any part of a word, you can use /\bword\b This will find word but not password.

I'm not a great fan of info, it looks too much like emacs on which it is based, I guess, at any rate, you can also do info info to get information about info. Alternatively, you could visit the gnu foundations' very own info page

Finally, there is the wealth of information that can be accessed on /usr/share/doc. Say you want to escape the editor war and simply use nano. You can go to this directory /usr/share/doc/nano-2.0.9 and read all the information about nano there. It looks like nano might be a bad example, but you get the idea.

No comments:

Post a Comment