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 systems that runs on desktops, laptops, server and other devices.
Both Ubuntu and Windows systems allow you to be productive, easy to use, reliable and enable you to install and run thousands of programs from gaming to productivity suite software for individuals and businesses.
About whereis command:
The whereis command is a command line utility that helps you find the locations of other command’s binary, source files and manual help pages.
Syntax:
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.
Options:
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 of 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 output of the effective lookup paths for whereis command |
–help | Display a help message and exit. |
Examples:
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:
Example:
whereis bash
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 path that the whereis command searches, simply run the whereis command with the -l option:
Example:
whereis -l
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.
Example:
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:
Example:
whereis bash nano
You should see an output as 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
That’s it!
Congratulations! You have learned how to use the whereis command on Ubuntu Linux