Linux whatis Command: Show One-Line Command Descriptions

whatis is a command that searches for the name of a manual page and shows a one-line description of that page. It is useful when you know the name of the command but want to quickly check what it does, or see if the same name exists in multiple manual sections.

By default, it looks for the exact page name, and man -f can also be used for the same purpose. If you want to search more broadly by subject or keywords in the description, apropos is more suitable than whatis.

What is the whatis command?

The NAME section of a manual page contains the page name and a short description. whatis searches the man-db index database for a page that matches the specified name and prints this description in a single line.

Since it does not open the full manual, it is good for quickly checking overviews of multiple commands. However, it is not a tool for showing the location of an executable or which command is actually selected by the shell.

Basic syntax and reading the output

whatis [option] name...

Check the one-line description of ls.

whatis ls

The output generally has the following structure.

ls (1)               - list directory contents

ls is the page name, (1) is the manual section, and the text after the hyphen is the one-line description. To see the entire usage, open it using the result's section number and name.

man 1 ls

Checking Multiple Names at Once

If you specify multiple arguments, you can see the results for each name together.

whatis ls cp mv rm

This is useful when comparing the functions of basic commands or checking the manuals installed on a server. Even if some names do not exist, the results for other names may be displayed, so in automation, you should check both the final exit status and the individual results.

When the Same Name Appears in Multiple Sections

If the same page name exists in multiple manual sections, whatis can output multiple lines. A common example is passwd, which is separated into a user command and a file format document.

whatis passwd

If you see passwd(1) and passwd(5) in the results, open each as follows.

man 1 passwd
man 5 passwd

The number in parentheses is not the program version but the manual section. The command usage is usually found in section 1 or 8, and configuration file formats are mainly found in section 5.

Regular Expression and Wildcard Search

Regular Expression -r

-r or --regex interprets the entered name as a regular expression. Results can appear even if only part of the page name matches.

whatis -r '^ssh'
whatis --regex 'printf$'

It is safer to enclose special characters of the regular expression in quotes so that they are not interpreted by the shell first.

Wildcard -w

-w or --wildcard finds names using shell-style wildcard patterns. The extended pattern must match the entire page name.

whatis -w 'ssh*'
whatis --wildcard '*printf*'

Without quotes, * could be expanded to filenames in the current directory first.

Limiting Manual Sections

With -s or --sections, you can search only the desired sections.

whatis -s 1 passwd
whatis -s 5 passwd
whatis --sections=2,3 printf
Section Main content
1 General User Commands and Executable Programs
2 System calls
3 Library Functions
5 Configuration files and file formats
8 System Management Commands

Frequently Used 'whatis' Options

Option Description
-r, --regex Processes the entered name as a regular expression.
-w, --wildcard Searches with shell-style wildcard patterns.
-s list, --sections=list Searches only the specified manual sections.
-l, --long Disables the behavior of truncating descriptions to fit terminal width.
-M path, --manpath=path Specifies the manual hierarchy path to search.
-L locale, --locale=locale Specifies the locale to use in that execution.

Relationship between 'whatis' and 'man -f'

In a man-db environment, man -f searches for the short description of the page in the same way as whatis.

whatis printf
man -f printf

You can use the format that is easier to remember. man -f is easy to remember as a related function of man, and whatis clearly shows in its name that it is for checking a one-line description.

Differences between whatis, apropos, and type

Command Questions being answered
whatis ls What does the manual page with this name describe?
apropos copy Which manual pages are related to this topic?
type ls How does the current shell interpret this command name?
command -v ls Can the current shell find this command and in what form?

Having a whatis result does not mean that an executable with the same name is currently in PATH. Conversely, even if there is an executable, there may be no result if the manual page is not installed.

Troubleshooting When There Are No Search Results

Check the Page Name and Installation Status

whatis basically finds the exact page name. If you entered words from a topic or description, use apropos, and check for the existence of an executable with command -v.

apropos archive
command -v tar
whatis tar

Updating the Index Database

If you installed the manual recently but no results appear, the man-db index may not have been updated yet.

sudo mandb

The system may also update it automatically during package installation or scheduled tasks. In environments without administrative privileges, first check the user manual path and distribution settings.

Check the Locale and MANPATH

locale
manpath
printf '%s\n' "$MANPATH"

The expected document may not be found due to the index for a specific locale or a user-specified MANPATH.

Using Results in a Script

You can check for the existence of a manual in a script, but the output statement may vary depending on the locale and the document content. Instead of parsing the display string, use the exit status, and if your goal is to check whether the actual command exists, use command -v.

if whatis "$1" >/dev/null 2>&1; then
 printf '%s\n' 'Manual description found.'
else
 printf '%s\n' 'Manual description not found.' >&2
fi

Frequently Asked Questions

Does whatis show the actual path of a command?

No. It shows the name and description of the manual page. Check the execution path and command type with type or command -v.

How can I search using words included in the description?

Use apropos keyword or man -k keyword. whatis is basically suitable when you already know the page name.

Why is the same name printed on multiple lines?

Because there are pages with the same name in different manual sections. Check the section number in parentheses and open the desired page with man section name.

Summary

whatis is a tool to check the role of a known manual page name in one line. It helps distinguish pages with the same name in different sections, quickly review several names, and check candidates before opening the necessary document with man.

When searching for documents using functional keywords, use apropos, and when checking the actual command interpretation, use type or command -v. Other basic commands can be found in List and Overview of Linux Commands.

Refer to official documents

More in This Category
Linux cmp Command: Compare Files Byte by Byte

Linux cmp Command: Compare Files Byte by Byte

Learn how Linux cmp compares two files byte by byte, reports the first mismatch, runs silently in scripts, limits ranges, and differs from diff and checksums.

Linux curl Command: Make URL Requests and Inspect HTTP Responses

Linux curl Command: Make URL Requests and Inspect HTTP Responses

Learn how to make URL Requests and Inspect HTTP Responses with the Linux curl command, including practical examples, key options, and important precautions.

Linux uniq Command: Remove or Count Adjacent Duplicate Lines

Linux uniq Command: Remove or Count Adjacent Duplicate Lines

Learn how to remove or count adjacent duplicate lines with the Linux uniq command, including practical examples, key options, and important precautions.

Linux rsync Command: Synchronize Files and Directories

Linux rsync Command: Synchronize Files and Directories

Learn how to synchronize Files and Directories with the Linux rsync command, including practical examples, key options, and important precautions.

Linux Tutorial / Search and Process Text with grep, sort, uniq, cut, and wc

Linux Tutorial / Search and Process Text with grep, sort, uniq, cut, and wc

Practice searching, sorting, grouping, extracting, and counting text with grep, sort, uniq, cut, and wc, including reproducible output and key caveats.

Linux mktemp Command: Create Secure Temporary Files and Directories

Linux mktemp Command: Create Secure Temporary Files and Directories

Learn how to create unpredictable temporary files and directories with Linux mktemp, use templates and TMPDIR, clean up with trap, and avoid unsafe dry runs.

Linux clear Command: Clear the Terminal Display

Linux clear Command: Clear the Terminal Display

Learn how to use the Linux clear command to clear the visible terminal screen and understand scrollback behavior, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux apk Command: Manage Packages on Alpine Linux

Linux apk Command: Manage Packages on Alpine Linux

Learn how to manage Packages on Alpine Linux with the Linux apk command, including practical examples, key options, and important precautions.

Linux gunzip Command: Decompress gzip Files

Linux gunzip Command: Decompress gzip Files

Learn how to decompress gzip Files with the Linux gunzip command, including practical examples, key options, and important precautions.

Linux mkfs Command: Create a New Filesystem

Linux mkfs Command: Create a New Filesystem

Learn how to create a New Filesystem with the Linux mkfs command, including practical examples, key options, and important precautions.