< Viewing and searching the man pages - 2.1 >

You get a huge amount of documentation with your Linux system. The online manual pages, or man pages for short, are a part of this documentation. They're the quickest way to get help with various Linux commands, so it's useful to know how to use them!

Author: Nana Långstedt < nana.langstedt at gmail.com >
tuXfile created: 20 December 2001
Last modified: 9 October 2005


back to

< How to use man pages >

If you're wondering how some command is used, or if you want more info about a particular command, you don't usually have to search for some text file that contains the help you need. You can read the reference manual for a command by simply typing man, and giving the name of the desired command as an argument to it. Yes, it really is so simple! Almost every command on a Linux system has a manual page. For example, if you want more info about the ls command, you just type:
$ man ls

Many X programs have man pages, too. For example, the following gives you the man page for xterm which is a terminal emulator:
$ man xterm

The manual page entry is usually so long that it cannot be displayed on your screen all at once. You can use the following keys and commands for moving around in the manual page:

Command / key Action
e, j, Enter, or Down move forward one line
y, k, or Up move backward one line
f, Space, or Page Down move forward one page
b, or Page Up move backward one page
/characters search the manual page for the specified characters
q quit

There are manual pages for different programs, utilities, functions and even for some configuration files. For example, the /etc/X11/XF86Config file is used for your X Window System settings. If you want more info about the file, you just read its manual page:
$ man XF86Config

The man pages are a very quick and easy way of getting help. Of course the man command itself has a manual page entry, so if you want more info about the man command itself:
$ man man

Don't the man pages sound too good to be true? Yes, they do, so there must be a catch. As I said earlier, they're reference manual pages, which means they're usually very brief and technical. Sometimes they look like encrypted Chinese. The man pages are great if you already know how to use the command and need only a reference or some extra info. They are definitely not tutorials and sometimes they're hard to understand, so they're not the best source of help for a newbie. However, the man pages are very useful because they're always there, only one command away, so you should try to learn to use them. The more man pages you read, the more you start to understand them.

< Searching with apropos >

What if you need to do a specific task but don't know what program or command to use for the task? Every man page entry contains a short description of the program, but the problem is that you don't know what program to use and what man page to read! With the apropos command you can search those descriptions and find the right tool for the job. You can use keywords to search both program names and their descriptions.

Let's have an example. Suppose you have a compressed gzip file, and you want to uncompress it. You probably want to use a program whose description or name contains the word "gzip", and now you can use apropos for finding such a program:

$ apropos gzip
gzip (1) - compress or expand files
zforce (1) - force a '.gz' extension on all gzip files

Now when you look at the output of apropos, you probably see that gzip might be what you're looking for. Now you know the command name, and can go read its man page:
$ man gzip

Let's have another example. As you know, you can list the directory contents with the ls command. But there are other commands for listing the directory contents, too! Now let's try to find out what those commands might be. The first thing that comes into your mind would probably be something like this:
$ apropos directory

This command probably gives you many lines of output, because "directory" is pretty common word in the descriptions of commands, and now you have a list of commands where most of the commands have nothing to do with listing the directory contents. But with apropos, you can use more than just one keyword:
$ apropos list directory

This didn't help much, though! Now you have even longer list than before! Why? Because apropos displays commands whose description has either "list" or "directory". In some situations this might be good, and exactly what you want, but not right now. Let's try more:

$ apropos "list directory"
dir (1) - list directory contents
ls (1) - list directory contents
vdir (1) - list directory contents

This gave you the output you wanted. Because we used double quotes here, apropos searched for a string that says "list directory", rather than for the occurrence of either word "list" or "directory".

Although you can do very simple searches with apropos, it's a very powerful tool and you can do advanced searches, too. For example, you can use the shell wildcards in your searches with the -w option. For more info about apropos, go read (you guessed it) its man page.

< Whatis >

While apropos searches for the descriptions in the man pages, whatis displays the description. It answers the question what is. Of course you can just take a look at the man page of a program to see what is the purpose of it, but if you're only interested in knowing what the program does, you can just use the whatis command for a quick answer:

$ whatis apropos
apropos (1) - search the manual page names and descriptions
$ whatis man
man (1) - an interface to the on-line reference manuals
man (7) - macros to format man pages
$ whatis whatis
whatis (1) - display manual page descriptions

Now you know where to go for help, but here I covered only a little part of the man, apropos and whatis commands. If you wonder what the numbers, like whatis (1), after the command names in my examples were, I suggest you read the manual page for the man command!

Linux help > Finding more help > The man pages

Copyright © 2001 - 2011 Nana Långstedt