FactorPad
Faster Learning Tutorials

Linux whereis command summary with examples

whereis allows you to located 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.
Paul Alan Davis, CFA, October 9, 2016
Updated: July 26, 2018
In this tutorial, 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 Next

~/ home  / tech  / linux essentials  / whereis command


The Linux whereis command

Beginner

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

Video Tutorial

Linux whereis command summary with examples (3:57)

Videos can also be accessed from the YouTube Playlist.

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.

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 here.

  • For the Outline to all 100 tutorials, click Outline.
  • To go back to the whoami command, hit Back.
  • To see the especially useful date command, click Next.

Outline Back Next

~/ home  / tech  / linux essentials  / whereis command



 
 
Keywords:
linux whereis command
unix whereis
linux where
locate man pages
find binaries in linux
find manuals in linux
find source code in linux
find help in linux
documentation in linux
locate help in linux
linux whereis syntax
linux whereis tutorial
linux search for file