How to use Linux whatis command
- 2021-07-26 09:08:47
- OfStack
01. Command Overview
The whatis command looks for keywords in a specific database file that contains short descriptions of system commands, and then sends the results to standard output. The lookup content must exactly match the keyword before it can be output. The whatis database file is created using the/usr/sbin/makewhatis command.
02. Command format
whatis [OPTION…] 关键词…
03. Common Options
Usage: whatis [OPTION...] Keywords ...
-d, --debug Output debugging information
-v, --verbose Output detailed warning information
-r, --regex Interpret each keyword as a regular expression
-w, --wildcard Wildcard characters are included in keywords
-l, --long Do not truncate output by terminal width
-C, --config-file= Documents Use this user settings file
-L, --locale= Region Define the locale used for this search
-m, --systems= System use manual pages from other systems
-M, --manpath= Path Set the path of the search man page to Path
-s, --sections= List , --section= List
search only these sections (colon-separated)
-?, --help give this help list
--usage give a short usage message
-V, --version print program version
04. Reference example
[deng@localhost ~]$ whatis ls
ls (1) - Column directory contents
ls (1p) - list directory contents
[deng@localhost ~]$ whatis cp
cp (1) - Copy files and directories
cp (1p) - copy files
[deng@localhost ~]$ whatis chown
chown (1) - Modify file owners and groups
chown (1p) - change the file ownership
chown (2) - change ownership of a file
chown (3p) - change owner and group of a file
[deng@localhost ~]$ whatis man
man (1) - Formatting and Displaying Online Help Pages
man (7) - Formatting macros for man pages
man (1p) - display system documentation
[deng@localhost ~]$
If you need to rebuild the database of information about this command, execute the following command:
[root@localhost ~]# makewhatis
Note: Centos 7.5 does not support this command for the time being.