The whereis command in Linux is used to locate the binary, source, and manual page files associated with a given command. It helps you find the different components related to a command, such as the executable binary, source code, and documentation.
Here’s an overview of how to use the whereis command:
- Basic Usage:
To find the locations of a command’s binary, source, and manual page files, simply typewhereisfollowed by the command name. For example:
whereis ls
This command will display the paths of the ls command’s binary, source, and manual page files.
- Displaying File Locations:
Thewhereiscommand will provide output indicating the locations of the command’s associated files. It may show one or more of the following file types:
binary: The location of the command’s executable binary file.source: The location of the command’s source code files, if available.manual: The location of the command’s manual page files.
- Examples:
- Finding the locations of a command’s files:
whereis grepThis command will display the paths of thegrepcommand’s binary, source, and manual page files, if they are available. - Checking the locations of a command’s files:
whereis gccThis command will display the paths of thegcccommand’s binary, source, and manual page files, if they are found in the system. - Locating the files associated with a system command:
whereis ls
This command will display the paths of thelscommand’s binary, source, and manual page files, which are typically located in different directories.
The whereis command is useful for locating the different components associated with a command, including its binary, source, and manual page files. It provides a quick way to find relevant files related to a command.
Note that not all commands have associated source code or manual pages, so the whereis command may not always return output for those file types.
For more information about the whereis command and its options, you can refer to the manual page by typing man whereis in your terminal.