whereis - macOS
Overview
whereis is a command-line tool used to locate the binary, source, or man page of a specified program or command. It is commonly used to find the path to an executable file or to determine if a particular program is installed on the system.
Syntax
whereis [options] [program]
Options/Flags
- -b: Search only for binary files (executables)
 - -m: Search only for man pages
 - -s: Search only for source code files
 - -u: Search all three categories: binaries, man pages, and source code
 - -l: Display the long format, providing more detailed information
 - -r: Search for related information, such as documentation or examples
 - -R: Perform a recursive search for related information within subdirectories
 - -d: Search only the directories specified in the PATH environment variable
 
Examples
- Find the location of the 
lsbinary: 
$ whereis ls
ls: /bin/ls /usr/bin/ls
- Check if 
nanois installed by searching for its man page: 
$ whereis -m nano
nano: /usr/local/man/man1/nano.1
- Find all related information about 
git: 
$ whereis -rR git
git: /usr/local/bin/git /usr/local/var/git /usr/local/share/man/man1/git.1
Common Issues
- Command not found: Ensure that the program you are searching for is installed and in the PATH environment variable.
 - Multiple results: Use the 
-loption to display additional details about each result. - No matches: Verify the spelling of the program name or specify the full path.
 
Integration
- With 
which: Usewhichto find the exact path to an executable binary, and thenwhereisto find additional information about it. - With 
find: Usefindto search for related files or directories based on specific criteria, and thenwhereisto locate the associated program. - With 
man: Usemanto display the man page for a program, and thenwhereisto locate the binary or source code file. 
Related Commands
whichfindman