$linuxjunkies
>

whereis(1)

Locate the binary, source, and manual page files for a command.

UbuntuDebianFedoraArch

Synopsis

whereis [OPTION]... [FILE]...

Description

whereis searches for the specified command by looking in a list of standard system directories. It locates binaries, source code, and manual page entries, which is useful for finding where a program is installed or whether documentation exists.

Unlike which, whereis searches a predefined set of directories rather than the PATH variable, making it faster and more thorough for discovering all instances of a command on the system.

Common options

FlagWhat it does
-bSearch only for binaries
-mSearch only for manual pages
-sSearch only for source files
-uSearch for unusual entries (files not matching standard patterns)
-B PATHSpecify directories to search for binaries
-M PATHSpecify directories to search for manual pages
-S PATHSpecify directories to search for source files
-lList search paths (show default directories used)

Examples

Find binary, source, and man page for the ls command

whereis ls

Find only the binary location of grep

whereis -b grep

Find only the manual page for bash

whereis -m bash

Find only source files for gcc (if available)

whereis -s gcc

Display the default search paths used by whereis

whereis -l

Search for ssh binary in /usr/bin and manual pages in default locations

whereis -B /usr/bin -m ssh

Related commands