Skip to content

Linux Foundations / Find your way around Linux ยท Step 28 of 63

Lesson: whatisSwitch
โ† Linux Foundations

Shell and files

whatis

Get a one line description of a command from the manual page index.

Sometimes you only want to know what a command is for, without reading a whole manual page. whatis prints the one line summary.

Basic use

$ whatis ls
ls (1)               - list directory contents

The line has three parts: the name, the manual section in brackets, and the short description. It is taken from the NAME heading of the manual page.

You can ask about several names at once:

$ whatis cp mv
cp (1)               - copy files and directories
mv (1)               - move (rename) files

Several sections

A name can have pages in more than one section, and each gets a line:

$ whatis passwd
passwd (1)           - change user password
passwd (1ssl)        - OpenSSL application commands
passwd (5)           - the password file

The exact list and wording vary between distributions. Use the number with man, for example man 5 passwd, to read the page you want.

Nothing appropriate

$ whatis qwerty
qwerty: nothing appropriate.

This means no matching page is in the index. The command might not exist, might have no manual page, or might be a shell built-in. It can also happen when the index has not been built yet. On many Linux systems an administrator can rebuild it with sudo mandb.

It does not prove that a command is missing. Check with type name.

whatis, apropos and man

whatis matches names. apropos searches names and descriptions for a keyword, which helps when you do not know the name:

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

man -f is equivalent to whatis, and man -k is equivalent to apropos. Once you have found the right command, use man for the details or --help for a quick list of options.

Try it

  1. Run whatis on ls, pwd and cat.
  2. Run whatis passwd and read the section numbers.
  3. Try a made-up name and read the message.
  4. Use apropos copy and pick one result to look up with man.

Check your understanding

whatis

All 4 sections ยท no timer

Unlimited retries

Questions from every section are combined into one assessment. Answer them all correctly to complete the article.

Your completion saves in this browser. Sign in to sync it to your account.