Skip to content

Whereis command on Linux (search for commands)

The whereis command on Linux searches the directories specified in the $PATH and $MANPATH variables for executables, source code, or manuals for a specified word.

Your most common options are:

  • -b: search for binaries only;
  • -m: search for manuals only;
  • -s: search only by source code

Example:

$ whereis ifconfig ifconfig: /sbin/ifconfig /usr/share/man/man8/ifconfig.8.gz

The whereis command is useful for showing the full path of commands that are in directories listed in the PATH variable.

In some situations, when there is more than one version of a program installed, it is good to use whereis to find out which executable the shell invokes.

Another example:

$ whereis php php: /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 register here. If you already have an account, or want to create one, just log in or create your user here.

Did you like it?

Share