whereis Command in Linux: Find Executable, Source Code and Manual
The whereis command in Linux searches the directories specified in the $PATH and $MANPATH variables for executables, source code, or manuals of a specified word.
Its most common options are:
- -b: search only for binaries;
- -m: search only for manuals;
- -s: search only for source code
Example:
$ whereis ifconfigifconfig: /sbin/ifconfig /usr/share/man/man8/ifconfig.8.gz
The whereis command is useful for showing the full path of commands that are in the directories listed in the PATH variable.
In some situations, when there is more than one version of a program installed, it's good to use whereis to find out which executable the shell invokes.
Another example:
$ whereis phpphp: /usr/bin/php /usr/lib64/php /etc/php.d /etc/php.ini /usr/include/php /usr/share/php /usr/share/man/man1/php.1.gz
Learn much more about Linux in our online course. You can enroll here. If you already have an account, or want to create one, just log in or create your user here.
Liked it? Share
That was just one piece. The course teaches the whole path — from your first command to exam day.