LinuxCommandLibrary

whatis

Display manual page descriptions

TLDR

Display a description from a man page

$ whatis [command]
copy

Don't cut the description off at the end of the line
$ whatis --long [command]
copy

Display descriptions for all commands matching a glob
$ whatis --wildcard [net*]
copy

Search man page descriptions with a regex
$ whatis --regex '[wish[0-9]\.[0-9]]'
copy

Display descriptions in a specific language
$ whatis --locale=[en] [command]
copy

SYNOPSIS

whatis [OPTION...] KEYWORD...
This displays the basic usage. KEYWORD represents the manual page names to search for. Options modify the search behavior.

PARAMETERS

KEYWORD...
    One or more manual page names to search for. The command will display the one-line description for each exact match found in the database.

-s section,...
    Search only the specified manual section(s). Sections can be given as a comma-separated list (e.g., '1,8').

--sections section,...
    Long option for -s.

-l
    Do not truncate output to the terminal width. Useful for displaying full descriptions that might otherwise be cut off.

--long
    Long option for -l.

-w string,...
    Interpret patterns as wildcards. For example, 'whatis -w ls*' might match 'ls' and 'lsattr'.

--wildcard string,...
    Long option for -w.

-r
    Interpret patterns as regular expressions. This allows for more complex search patterns, similar to apropos's default behavior.

--regex
    Long option for -r.

-V
    Display version information and exit.

--version
    Long option for -V.

--help
    Display a help message and exit.

DESCRIPTION

whatis is a fundamental Linux command used to quickly look up a brief description of a specified command, system call, or file. It searches the NAME section of the system's manual pages database for exact matches of the keywords provided. When a match is found, whatis displays the one-line description associated with that manual page entry. This command is particularly useful when you know the precise name of a command but need a quick reminder of its function without opening the full man page. It relies on a pre-built database (often created and updated by mandb) of manual page information. Unlike apropos, which searches for substrings and typically uses more flexible matching, whatis performs a precise, full-word match, making it ideal for targeted lookups.

CAVEATS

The whatis command relies on a pre-built database of manual page descriptions. If this database is not present or is out of date, whatis may return no results or incomplete information. The database is typically created or updated using the mandb command (e.g., 'sudo mandb'). Additionally, whatis performs an exact, full-word match by default, meaning it will not find partial matches. For substring or more flexible searches, consider using apropos or whatis with the -r (regex) or -w (wildcard) options.

DATABASE REQUIREMENT

For whatis to function correctly, an up-to-date manual page index database must exist. This database is typically built and maintained by the mandb command. If you install new manual pages or notice whatis not returning expected results, running 'sudo mandb' is often the first troubleshooting step.

MATCHING BEHAVIOR

whatis performs a full-word search by default. For example, 'whatis cat' will match the 'cat' command, but 'whatis c' will not. To search for partial matches or use more advanced patterns, employ the -w (wildcard) or -r (regex) options, which makes its behavior closer to that of apropos.

HISTORY

The whatis command has been a staple utility in Unix-like operating systems for decades, providing a quick way to get a summary of commands. Historically, it often functioned by searching a plain text file (whatis.db or similar) containing one-line descriptions. Modern implementations, especially those integrated with the man-db package, leverage more robust databases (like GDBM or Berkeley DB) that are indexed by the mandb utility. In many contemporary Linux distributions, whatis is often a symbolic link to or a functional alias of apropos, with its default behavior configured to perform exact word matches, thus maintaining its distinct purpose while sharing underlying search logic.

SEE ALSO

man(1), apropos(1), mandb(8)

Copied to clipboard