whatis command in Linux with Examples

27 May, 2019
whatis command in Linux is used to get a one-line manual page descriptions. In Linux, each manual page has some sort of description within it. So this command search for the manual pages names and show the manual page description of the specified filename or argument.
Syntax:
whatis [-dlv?V] [-r|-w] [-s list] [-m system[, ...]] [-M path] [-L locale] [-C file] name ...
whatis command with help option: The whatis command throws an error if no options, filename or arguments are passed. So, when we use the -h option, it gives the general syntax along with the various options that can be used.
Example:
Options:
whatis -d: This option prints the debugging information.Example:whatis -d ls
Example:
whatis -d ls
whatis -v: This option will prints verbose warning messages.Example:whatis -v ls
Example:
whatis -v ls
whatis -r : This option interprets each of the name as a regular expression. If any of the names match any part of a page name, a match will be made. This option causes the whatis command to be somewhat slower due to the nature of database searches.Example:whatis -r ls
Example:
whatis -r ls
whatis -w : This option interprets each name as a pattern containing shell style wildcards. For a match about to make, an expanded name needs to match the entire page name. This option causes the whatis command to be somewhat slower due to the nature of database searches.Example:whatis -w ls
Example:
whatis -w ls
whatis -l: This option does not trim output to the terminal width. Normally, the output will be truncated to the terminal width just to avoid ugly results from poorly-written NAME sections.Example:whatis -l cat
Example:
whatis -l cat
whatis -s: This option will going to search only the given manual sections. The list is a colon or a comma-separated list of sections. If an entry in list is just a simple section, for example, “3”, then all the displayed list of descriptions will include pages in sections “3”, “3perl”, “3x”, and so on; while if any of the entry in list has an extension, for example “3perl”, then only the list will include pages in that exact part of the manual section.Example:whatis -s 3 cat
Example:
whatis -s 3 cat
whatis -m: If our system has access to any other operating system’s manual page names, then they can be accessed using this option. If you want to search NewOS’s manual page names, use this option -m NewOS.Example:whatis -m NewOS rmdir
Example:
whatis -m NewOS rmdir
whatis -M: This option will specify an alternate set of colon-delimited manual page hierarchies to search. whatis uses the $MANPATH environment variable by default, unless it is empty or unset, in which case it will be going to determine an appropriate manpath based on your $PATH environment variable. This option overrides the contents of $MANPATH.Example:whatis cd -M --manpath=/lib/cd
Example:
whatis cd -M --manpath=/lib/cd
whatis -L : This option is used to temporarily override the determined value, use this option as to supply a locale string directly to whatis. Note that it will not take any effect until the search for pages actually begins. Output such as the help message will always going to be displayed in the initially determined locale.Example:whatis rm -L locale
Example:
whatis rm -L locale
whatis -C: This option uses this user configuration file rather than the default of ~/.manpath.Example:whatis -C file
Example:
whatis -C file
whatis -help: This option will print a help message and exit.Example:whatis -help
Example:
whatis -help
whatis -? : Yet another option with the help of which you can print a help message.Example:whatis -?
Example:
whatis -?
whatis –usage : This option will prints a short usage message and exit.Example:whatis --usage
Example:
whatis --usage
whatis -V : This option will display version information.Example:whatis -V
Example:
whatis -V
linux-command
Linux-misc-commands
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.