The whereis command is used to locate the path of the binary program
, source code file, man page and other related files of the command.
The search speed of whereis command is very fast, because it does not search randomly in the disk, but in a database; the database is automatically created by the linux system, contains information about all local files, and is updated once a day by automatically executing the updatedb command. Because of this, the search results of the whereis command are sometimes inaccurate. For example, the newly added file may not be searched because the database file has not been updated.
: whereis [parameter] [command name]
||Find a binary program or command
||Find a binary program or command from the specified directory
||Find man manual files
||Find the man manual file from the specified directory
||Find only source code files
||Find the source code file from the specified directory
Show the location of the ln command program and man page:
[root@linuxstar ~]# whereis ln ln: /usr/bin/ln /usr/share/man/man1/ln.1.gz /usr/share/man/man1p/ln.1p.gz
Display the path of the binary program of the ln command:
[root@linuxstar ~]# whereis -b ln ln: /usr/bin/ln
Display the path of the man page of the ln command:
[root@linuxstar ~]# whereis -m ln ln: /usr/share/man/man1/ln.1.gz /usr/share/man/man1p/ln.1p.gz