Open In App

whatis Command in Linux with Examples

Improve
Improve
Like Article
Like
Save
Share
Report

whatis command in Linux is used to get a one-line manual page description. 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 of the `whatis` command in Linux

whatis [option] [command_name]

[option] = replace it with the desired option of yours.

[command_name] = replace it with the desired command you want.

Options available in `whatis` command in Linux

The `whatis` command supports several options to enhance its functionality.

Options                                                Description
`-h` or `–help`

The whatis command throws an error if no options, filenames, 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.

`-d`

This option prints the debugging information. 

`-v`

This option will print verbose warning messages. 

`-r` or `–regex`

This option interprets each of the names as a regular expression. A match will be made if any of the names match any part of a page name. This option causes the whatis command to be somewhat slower due to the nature of database searches.

`-w`  or  `–wildcard`

This option interprets each name as a pattern containing shell style wildcards. An expanded name needs to match the entire page name for a match about to be made. This option causes the whatis command to be somewhat slower due to the nature of database searches.

`-l`  or `–long`

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.

`-s`  or  `–sections`

This option will be 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,

`-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. 

`-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.

` -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 have any effect until the search for pages actually begins. Output such as the help message will always be displayed in the initially determined locale. 

`-C`

This option uses this user configuration file rather than the default of ~/.manpath.

` -?`

Yet another option with the help of which you can print a help message.

`-V`

This option will display version information.

Examples and Usage of `whatis` command in Linux

`-h` option in `whatis` command

Syntax:

whatis -h
whatis -h

whatis -h

`-d` option in `whatis` command

 This option prints the debugging information. 

whatis -d ls
whatis -d ls

whatis -d ls

`-v` option in `whatis` command

This option will print verbose warning messages. 

Syntax:

whatis -v ls
whatis -v ls

whatis -v ls

`-r` option in `whatis` command 

Supports regular expression searches.

Syntax:

whatis -r ls
whatis -r ls

whatis -r ls

`-w` option in `whatis` command

Enables wildcard searches using the specified pattern.

Syntax:

whatis -w ls
whatis -w ls

whatis -w ls

`-l` option in `whatis` command

Displays long descriptions in addition to the summary.

  • Example:
whatis -l cat
whatis -l cat

whatis -l cat

`-s` option in `whatis` command

Allows users to specify the sections from which to retrieve the information. By default, it searches all sections.

Syntax:

whatis -s 3 cat
whatis -s 3 cat

whatis -s 3 cat

`-m` option in `whatis` command

 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. 

Syntax:

whatis -m NewOS rmdir
whatis -m NewOS rmdir

whatis -m NewOS rmdir

`-M` option in `whatis` command

The -M option specifies an alternate set of colon-delimited manual page hierarchies to search. It overrides the default value of the $MANPATH environment variable.

Syntax:

whatis cd -M --manpath=/lib/cd
whatis cd -M --manpath=/lib/cd

whatis cd -M –manpath=/lib/cd

`-L` option in `whatis` command

The -L option is used to temporarily override the determined locale value. It allows users to supply a locale string directly to the ‘whatis’ command.

Syntax:

whatis rm -L locale
whatis rm -L locale

whatis rm -L locale

`-C` option in `whatis` command

The -C option allows users to specify a user configuration file for the ‘whatis’ command. It overrides the default configuration file location ~/.manpath.

Syntax:

whatis -C file

`-?` option in `whatis` command

 Yet another option with the help of which you can print a help message. 

Syntax:

whatis -?
whatis -?

whatis -?

`–usage` option in `whatis` command

This option will print a short usage message and exit. 

Syntax:

whatis --usage
whatis --usage

whatis –usage

`-V` option in `whatis` command

This option will display version information.

Syntax:

whatis -V

whatis -V

Conclusion

In this article we have discussed `whatis` command in Linux is a versatile tool that provides one-line manual page descriptions for commands. We have discussed a few options available in `whatis` command to increase its functionality. By learning `whatis` command one can quickly explore and understand the functionalities of various commands. 



Last Updated : 10 Jun, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads