What is the difference between 'whereis' and 'which'?

The whereis and which commands serve different purposes in locating files related to commands in a Linux system:

  • whereis <command>:

    • Searches for the binary executable, source code, and manual pages associated with the specified command.
    • Provides a comprehensive output that includes multiple file types and locations.
    • Searches in predefined directories, which may include system paths for binaries, libraries, and man pages.
  • which <command>:

    • Searches specifically for the binary executable of the specified command.
    • Returns the path of the first matching executable found in the directories listed in the PATH environment variable.
    • Does not provide information about source files or manual pages.

In summary, whereis gives a broader view of all related files, while which focuses solely on finding the executable file for a command.

0 Comments

no data
Be the first to share your comment!