How to use whereis to find command binariers and man pages

whereis is used for locating a file’s binary, source and its associated man page, in Unix and Linux.

It is easy to use and displays a short output:

$ whereis bash
bash: /bin/bash /etc/bash.bashrc /usr/share/man/man1/bash.1.gz

If you need to find out only the associated man page/section, use whereis -m:

$ whereis -m bash
bash: /usr/share/man/man1/bash.1.gz

For displaying the file’s binaries, use the -b argument:

$ whereis -b vim
vim: /usr/bin/vim /usr/bin/vim.basic /usr/bin/vim.tiny /etc/vim /usr/share/vim

whereis -m is usefull when you need to find the man sections of a configuration file or C function (example: /etc/passwd or printf) because this types of files usually have two man sections.

$ whereis -m passwd
passwd: /usr/share/man/man1/passwd.1ssl.gz /usr/share/man/man1/passwd.1.gz /usr/share/man/man5/passwd.5.gz

So, we can find info about the /etc/passwd file in both the 1st and the 5th man sections:

$ man passwd
$ man 5 passwd

Tagged with: , , , ,
Posted in The Linux and Unix Articles!

Leave a Reply

Your email address will not be published. Required fields are marked *




Subscribe to get the latest Linux news and how to guides directly on your e-mail!