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.
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.
- whatis -d: This option prints the debugging information.
whatis -d ls
- whatis -v: This option will prints verbose warning messages.
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.
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.
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.
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.
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.
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.
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.
whatis rm -L locale
- whatis -C: This option uses this user configuration file rather than the default of ~/.manpath.
whatis -C file
- whatis -help: This option will print a help message and exit.
- whatis -? : Yet another option with the help of which you can print a help message.
- whatis –usage : This option will prints a short usage message and exit.
- whatis -V : This option will display version information.