Locating Binaries, Sources, and Manual Pages with whereis
The whereis
command is a versatile tool that allows you to locate the binary, source, and manual page files for a given command or program on your Linux system. Let's explore how to use the whereis
command to find these different types of files.
Locating Binary Files
To locate the binary file for a command, you can use the -b
option with the whereis
command. For example, to find the binary file for the ls
command, you would run:
whereis -b ls
This will output the location of the binary file:
ls: /usr/bin/ls
Locating Source Files
To locate the source files for a command, you can use the -s
option with the whereis
command. For example, to find the source files for the ls
command, you would run:
whereis -s ls
This will output the location of the source files:
ls: /usr/src/linux-headers-5.15.0-60/include/linux/ls.c
Locating Manual Pages
To locate the manual pages for a command, you can use the -m
option with the whereis
command. For example, to find the manual page for the ls
command, you would run:
whereis -m ls
This will output the location of the manual page file:
ls: /usr/share/man/man1/ls.1.gz
Combining Options
You can also combine the different options to search for multiple types of files at once. For example, to find the binary, source, and manual page files for the ls
command, you would run:
whereis -bsm ls
This will output the locations of all the relevant files:
ls: /usr/bin/ls /usr/src/linux-headers-5.15.0-60/include/linux/ls.c /usr/share/man/man1/ls.1.gz
By using the various options available with the whereis
command, you can efficiently locate the different types of files associated with a command or program on your Linux system.