FactorPad
Build a Better Process

Linux whereis Command Summary with Examples

Linux whereis allows you to locate binaries, manuals and source code.
  1. Purpose - Learn what whereis is for and how to find help.
  2. Options - Review a few common options and arguments.
  3. Examples - Walk through code examples with whereis.
  4. A tip - Finish off with one more insight.
face pic by Paul Alan Davis, CFA
Updated: February 23, 2021
In this tutorial on whereis, 14 of 100, below find a 3-4 minute introductory video, a text-based tutorial and all of the code examples from the video.

Outline Back Tip Next

/ factorpad.com / tech / linux-essentials / whereis-command.html


An ad-free and cookie-free website.


Examples of the Linux whereis Command

Beginner

Learn to find program binaries and manuals at the Linux command line.

Video Tutorial

Videos can also be accessed from the Linux Essentials Playlist on YouTube.

Linux whereis Command Summary with Examples (3:57)

Video Script

The Command and Why You Need It

Our fourteenth word, or command to memorize is whereis from the category Help.

whereis allows you to locate binaries, manuals and source code.

Common Linux whereis Options
-options description
-h Print help screen
-b Display path to binaries
-m Display path to user manual pages

Recall from our last video (tutorial) we talked about gaining our bearings and whereis will help us answer the where question: where are the important files associated with a command?

Before we start, it helps to think of commands as mini programs and most follow this structure: command -option(s) argument(s).

The whereis command has 10 options and the most common argument is the command in question.

We'll cover the options -h, -b for binaries, and -m for manuals, but skip -s for downloaded source code compiled locally.

So why is whereis an important command? Well, whereis helps us find relevant files easily. And now you know how to do that.

Demonstration

Okay, the best way to embed this in your memory is by typing in your own terminal window.

Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.

Here we go, type whereis whereis.

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

First, binaries here. See how logical the short abbreviations are? bin for binaries. Next are manual files, and if the source code isn't available, it'll be ignored (as is the case here).

Next, type whereis -h.

$ whereis -h Usage: whereis [options] <file> Options: -b search only for binaries -B <dirs> define binaries lookup path -m search only for manuals -M <dirs> define man lookup path -s search only for sources -S <dirs> define sources lookup path -f terminate <dirs> argument list -u search for unusual entries -l output effective lookup paths For more details see whereis(1).

That's a tidy list of options, lowercase -b and -m are most common. Notice the -h option is missing (even though we just used it).

If this inconsistency bothers you, don't despair. Recall Linux is free and is the work of many contributors. Yes, it's quirky, but just be patient with it.

And let's find the binaries for a few commands we've explored. Try whereis -s man less type.

$ whereis -b man less type man: /usr/bin/man /usr/local/man /usr/share/man less: /usr/bin/less /bin/less type: $ type type type is a shell builtin

Oh yeah, type is a shell builtin (so help is found in the bash command manual).

Last, let's search for manuals for whoami, whatis and whereis.

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

A Final Tip

Okay now you know how to use whereis. And you know the syntax for commands, options and arguments.

One last tip about the whereis command. If you're curious about Linux search paths, check out the -l option. Now that we've seen whoami, whatis, whereis, do you wonder what's next?

Okay, thanks for visiting today. I hope this was a fun introduction to the whereis command.


Learn More About The Series

For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:


What's Next?

Learn faster by combining text with video. Subscribe at YouTube for new content reminders. Twitter @factorpad too.

Outline Back Tip Next

/ factorpad.com / tech / linux-essentials / whereis-command.html


linux whereis command
linux where
find files in linux
how to find binaries in Linux
locate manuals in linux
find source code in linux
linux whereis summary
linux whereis examples
unix whereis
linux find file
linux search for file
linux whereis syntax
linux whereis tutorial

A newly-updated free resource. Connect and refer a friend today.