- Published on
whereis command - displays the path of commands and related files
Jonas
2 min read
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.
Syntax: whereis [parameter] [command name]
Command parameters
-b | Find a binary program or command |
-B | Find a binary program or command from the specified directory |
-m | Find man manual files |
-M | Find the man manual file from the specified directory |
-s | Find only source code files |
-S | Find the source code file from the specified directory |
Example
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.gzDisplay the path of the binary program of the ln command:
[root@linuxstar ~]# whereis -b ln ln: /usr/bin/lnDisplay 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