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 Directory Structure Explained: Purpose of Major Directories

Linux Directory Structure Explained: Purpose of Major Directories

Understand the purpose of major Linux directories such as /etc, /var, /usr, /home, /proc, and /sys, and learn where common system files belong.

Linux ethtool Command: Inspect Network Link and Driver Settings

Linux ethtool Command: Inspect Network Link and Driver Settings

Learn how to inspect Network Link and Driver Settings with the Linux ethtool command, including practical examples, key options, and important precautions.

Linux paste Command: Join Corresponding Lines Side by Side

Linux paste Command: Join Corresponding Lines Side by Side

Learn how to join Corresponding Lines Side by Side with the Linux paste command, including practical examples, key options, and important precautions.

Linux Tutorial / Inspect, Pause, and Stop Processes

Linux Tutorial / Inspect, Pause, and Stop Processes

Inspect Linux processes with ps, top, and pgrep, then safely pause, resume, and terminate a practice process while distinguishing shell jobs from services.

Linux Tutorial / Navigate Directories with pwd, ls, cd, and tree

Linux Tutorial / Navigate Directories with pwd, ls, cd, and tree

Use pwd, ls, cd, and tree to find your current location, inspect directories, navigate paths, and check where each command takes you.

Linux dirname Command: Extract the Directory Part of a Path

Linux dirname Command: Extract the Directory Part of a Path

Learn how to use the Linux dirname command to remove the final component of a path and return its directory portion, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux Tutorial / Manage Files and Directories: Create, Copy, Move, and Delete

Linux Tutorial / Manage Files and Directories: Create, Copy, Move, and Delete

Practice creating, copying, renaming, moving, and deleting files and directories in a dedicated folder while checking each result safely.

Linux time Command: Measure Command Execution Time

Linux time Command: Measure Command Execution Time

Learn how to use the Linux time command to measure elapsed, user CPU, and system CPU time for a command, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux hostnamectl Command: Show and Change the Host Name

Linux hostnamectl Command: Show and Change the Host Name

Learn how to show and Change the Host Name with the Linux hostnamectl command, including practical examples, key options, and important precautions.