whatis command in Linux with Examples

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

  • whatis -v: This option will prints verbose warning messages.

    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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • whatis -C: This option uses this user configuration file rather than the default of ~/.manpath.

    Example:

    whatis -C file
  • whatis -help: This option will print a help message and exit.

    Example:

    whatis -help

  • whatis -? : Yet another option with the help of which you can print a help message.

    Example:

    whatis -?

  • whatis –usage : This option will prints a short usage message and exit.

    Example:

    whatis --usage

  • whatis -V : This option will display version information.

    Example:

    whatis -V



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.