Skip to content

Use of man, whatis, and apropos commands

man command

The man command is used to format and display the man pages. The man pages are a user manual that is by default built into most Linux distributions It provide extensive documentation about commands and other aspects of the system, including configuration files, system calls, library routines and the kernel (i.e., the core of the operating system)

man [options] keyword/name

man is most commonly used without any options and with only one keyword. The keyword is the exact name of the command or other item for which information is desired. For example, the following provides information about the ls command (which is used to list the contents of any specified directory):

$ man ls
Following are different options can be used with man command:

C config_file Specify the configuration file to use; the default is /etc/man.config. 
M pathSpecify the list of directories to search for man pages. Separate the directories
with colons. An empty list is the same as not specifying -M at all. 
aBy default, man will exit after displaying the first manual page it finds. Using this
option forces man to display all the manual pages that match name, not just the
cReformat the source man page, even when an up-to-date cat page exists. This
can be meaningful if the cat page was formatted for a screen with a different
number of columns, or if the preformatted page is corrupted.
dDon’t actually display the man pages, but do print gobs of debugging information.
DBoth display and print debugging info.
fEquivalent to whatis.
F or –preformatFormat only – do not display.
hPrint a one-line help message and exit.
kEquivalent to apropos.
KSearch for the specified string in *all* man pages. Warning: this is probably very
slow! It helps to specify a section. 

The Whatis and Apropos Commands

During your Linux exploration, it sometimes happens that you forget a command or two or misremember what it does. Luckily, Linux takes this into consideration and has a solution to help retrieve those commands that have escaped into the forgettery.

Whatis Command

Whatis is a command that’s bound to come in handy, especially while you’re learning Linux. By typing “whatis” followed by a command, Linux returns the first line of the Man-page (manual page) for that command. Here’s an example to show you what the “cp” command does:

$ whatis cp
This returns:
cp (1) – copy files and directories
The command is listed followed by a number in parentheses. The number refers to the section of the man-pages (manual pages) that the command can be found in.

For the command ifconfig:
$ whatis ifconfig
ifconfig (8) – configure a network interface
If you wanted more information about one of the commands, then you need to use man command.

Apropos Command

Linux knows so many commands, it’s impossible to remember them all. Imagine you know only a part of the name or description of a command. Say for example, you remember “zip,” but not the complete command.
You can use the apropos command to find Linux commands that are related to one or more keywords. As i mentioned, if you remember only “zip” word then you can type:
 $ apropos zip
which will write out a table containing all Linux commands that include “zip” in the command name or in the brief description provided in the Name section of the man page of the command.

You may want to see
How to sort contents of a file

The sort command is used to sort the contents of a file. You can sort the data in a text Read more

How to use sed command in Linux

sed, short for "stream editor", allows you to filter and transform text. A stream editor is used to perform basic Read more

How to use crontab in Linux

Cron is the system process that will automatically perform tasks for you according to a set schedule. The schedule is Read more

How to extract archive file in Linux

To extract archive file in Linux, you can use the tar command, used for extracting content from the archive files. "tar" Read more

Leave a Reply

Your email address will not be published.