5. Other Help Commands

While man pages and info pages are the most reliable sources of information on a Linux system, there are other ways to obtain information if you still can't find your answer. For instance, what if you don't know the command you're looking for?

5.1. apropos

The other day a friend of mine was having a problem with a boot disk and asked me how to fix it. So my first instinct was to try:

bash$ man bootdisk

Unfortunately, this is what I got:

No manual entry for bootdisk

I knew that I had read something about boot disks before, but I couldn't seem to remember where. This is where the apropos command comes in handy. Apropos is kind of like saying, "I can't quite remember what that cool movie was, but I know the title started with 'The Good'" and having a friend start giving possible movies. That's what apropos does, only for topics on a Linux system. So here's what I did:

bash$ apropos bootdisk
mkboot (8)           - makes a bootdisk

Just like that, apropos gave my answer! Now all I had to do was:

bash$ man mkboot

Sometimes it will give you back more than one answer. Just go through each one until you get what you're looking for.

5.2. Using dpkg to find information

dpkg is the program which controls all the installation of .deb packages. This program can be used to help you find particular files or information about a program you may have installed but can't seem to get working.

Suppose you just installed a program but you can't find any documentation in the usual places (i.e. /usr/share/doc/). How would you find out where the package put the documentation? Let's pretend I didn't know where abiword installed it's documentation. I would use the dpkg command like this to find it:

bash$ dpkg --listfiles abiword

This simply tells dpkg to list all the files that were installed with the abiword package. Here's the result of that command:

/.
/usr
/usr/bin
/usr/bin/AbiWord_d
/usr/bin/AbiWord
/usr/bin/abiword
/usr/share
/usr/share/doc
/usr/share/doc/abiword
/usr/share/doc/abiword/examples
/usr/share/doc/abiword/examples/en-US
/usr/share/doc/abiword/examples/en-US/Latin1.abw
/usr/share/doc/abiword/copyright
/usr/share/doc/abiword/README.gz
/usr/share/doc/abiword/changelog.Debian.gz/

In the example above you can see the doc directory quite nicely but in reality when I executed this command all the files scrolled right off the screen and I wasn't able to read any of them. For especially large packages with lots of files we are going to need to enlist the help of another program called grep. Here's the new command to find what we are looking for:

bash$ dpkg --listfiles abiword | grep doc

Tip

The "|" character or pipe as it's called is typed by pressing Shift-\

This command tells dpkg to list all the files installed by abiword and then send that list to the program grep. grep then searches through the list looking for any occurrence of the word "doc". When grep finds the word doc on a line it prints that line to the computer screen. Here's what the output looks like:

/usr/share/doc
/usr/share/doc/abiword
/usr/share/doc/abiword/examples
/usr/share/doc/abiword/examples/en-US
/usr/share/doc/abiword/examples/en-US/Latin1.abw
/usr/share/doc/abiword/copyright
/usr/share/doc/abiword/README.gz
/usr/share/doc/abiword/changelog.Debian.gz

This is much easier to read then the previous example, and as you can see, it only printed out lines with the occurrence of "doc". The files didn't scroll of the screen and it's a nice short list. I can now look in those directories and see what I can find. This might seem like a silly example, but if you look closely you can use this to search for all kinds of things. You could replace "doc" with any word you are looking for. Some examples which come to mind might be "help", "ref", "html", "config", "conf", "etc", and "examples".

For more information about using grep, check out the NewbieDoc grep document.