Wednesday, August 5, 2009

One man and friends

Linux has a lot of commands and that's why it can look scary at the beginning. What you really need is to know how and where to look for help. There are several commands that can help us:

whatis ( = man -f),
apropos ( = man -k),

man gives you the description of every command (unless it doesn't have the manual). If you want to find out about man, type:

$ man man

Sometimes there are more than one manual for specific command. If we want to get to the exact manual page we type:

man <man page> <command>

getopt is good example of this. The man page 1 describes the C language function , whereas page 3 describes bash shell command.

info is an interactive help system, where you can navigate through. You can type just info
to get the full manual or type info info to get the information on info command. There is one more command called pinfo, which gives you the same as info, however it's more colourful and based on lynx-like (console webbrowser) menu. You can cycle through info pages with n and p. Quit with q.

whatis is really useful and allows us to get short description of linux commands. This is what we can find out about ls command:

$ whatis ls

ls (1) - list directory contents
ls (1p) - list directory contents

By the way the same effect we can be achievied using man -f.

Another useful command is apropos. It looks for text strings inside whatis database. Typing:

$ apropos man

gives us all the commands and their descriptions containing 'man' string somewhere inside. The same effect gives us man -k command.

To see what the commands in /bin/ directory do we type:

$ whatis $(ls /bin) | grep -v aprioprate

No comments:

Post a Comment