This brief tutorial shows students and new users how to use the whereis command on Ubuntu to find binary, source, and help manual pages for a given command.
For example, if you want to find the location of the bash command, including its source files and help manual pages, you use the whereis command in Linux.
For students or new users looking for a Linux system to start learning on, the easiest place to start is Ubuntu Linux OS. It’s a great Linux operating system for beginners.
Ubuntu is an open-source Linux operating system that runs on desktops, laptops, servers, and other devices.
About whereis command:
The whereis command is a command line utility that helps you find the locations of other commands’ binary, source files, and manual help pages.
The syntax is the rule and format of how the whereis command can be used. These syntax options can be reordered, but a straight format must be followed.,.
Below is an example syntax of how to use the whereis command.
whereis [options] command.
The command line options are switches or flags that determined how the commands are executed or controlled. They modify the behavior of the commands. They are separated by spaces and followed after the commands.
Below are some options for the whereis command:
|command||Replace command a command you want to search for|
|-b||If you use the -b option, the whereis command searches for a command’s binary file only.|
|-m||Use the -m option to only search for a command’ manual file and related information only|
|-s||Use the -s option to force whereis command to only search for a command source file only|
|-l||The –l option displays the output of the effective lookup paths for whereis command|
|–help||Display a help message and exit.|
Below are some examples of how to run and use the whereis on Ubuntu Linux.
Simply run the whereis to invoke it.
If you want to use the whereis command to find the binary, source file, and manual help pages for the bash command, simply run the command below:
When you run the above command, a similar line below should be displayed on your screen with the binary file, source, and help pages for the bash command:
Output: bash: /bin/bash /etc/bash.bashrc /usr/share/man/man1/bash.1.gz
The line above shows /bin/bash as the binary command file, /etc/bash.bashrc as its source, and /usr/share/man/man1/bash.1.gz as its manual page.
To list and identify all the location paths that the whereis command searches, simply run the whereis command with the -l option:
To search for a command’s binary file only and not include its source and help pages, run the whereis command with the -b option.
whereis -b bash
To display a command’s source file only without its binary file or help pages, run the where’s command with the -s option:
whereis -s bash
To display information for more than one command, simply include multiple commands when running the whereis command:
whereis bash nano
You should see the output below:
Output: bash: /bin/bash /etc/bash.bashrc /usr/share/man/man1/bash.1.gz nano: /bin/nano /usr/share/nano /usr/share/man/man1/nano.1.gz /usr/share/info/nano.info.gz
Congratulations! You have learned how to use the whereis command on Ubuntu Linux