whereis Command: Tutorial & Examples
Display the location of a command, file, or manual page
The whereis
command in Linux is a command-line utility that is used to locate the binary, source, and manual page files for a given command. The basic syntax for the command
is whereis [command]
.
When you run whereis
command followed by a command name, it will search through the standard Linux directories for binary, source, and manual page files related to that command
and will print the path of those files if they are found.
For example, if you run the command whereis ls
, it will return the location of the binary, source and manual page files for the ls
command, for
example /bin/ls
and /usr/share/man/man1/ls.1.gz
.
The whereis
command is useful when you are trying to find the location of a command that is not in your current PATH
environment variable or when you want to know the location
of the source code of a command.
It is important to note that the whereis
command only searches through a predefined set of directories, so it may not find all files related to a command if they are located in a
non-standard directory or if the command is not installed on the system. To search also in other directories, you may use the find
command.