How does the whereis command locate binary files?

The whereis command locates binary files by searching through predefined paths in the Linux filesystem. These paths typically include standard directories where binaries are stored, such as /usr/bin, /bin, and /usr/local/bin.

When you run a command like whereis grep, it checks these directories for the binary executable associated with the command and returns the location. You can also use the -b option to specifically search for binary files, which will limit the output to only the binary locations without including manual pages or source files.

For example:

whereis -b grep

This command will output the path to the grep binary, such as:

grep: /usr/bin/grep

0 Comments

no data
Be the first to share your comment!