whereis(1)

whereis1

Locate programs

Usage

whereis [-abmqsux] [-BMS dir ... -f] program ...

Overview

The whereis utility checks the standard binary, manual page, and source directories for the specified programs, printing out the paths of any it finds. The supplied program names are first stripped of leading path name components, any single trailing extension added by gzip(1), compress(1), or bzip2(1), and the leading ‘s.’ or trailing ‘,v’ from a source code control system.

The default path searched is the string returned by the sysctl(8) utility for the “user.cs_path” string, with /usr/libexec and the current user's $PATH appended. Manual pages are searched by default along the $MANPATH. Program sources are located in a list of known standard places, including all the subdirectories of /usr/src and PORTSDIR If the environment variable is not defined it defaults to /usr/ports.

The following options are available:

-B

Specify directories to search for binaries. Requires the -f option.

-M

Specify directories to search for manual pages. Requires the -f option.

-S

Specify directories to search for program sources. Requires the -f option.

-a

Report all matches instead of only the first of each requested type.

-b

Search for binaries.

-f

Delimits the list of directories after the -B, -M, or -S options, and indicates the beginning of the program list.

-m

Search for manual pages.

-q

(“quiet”). Suppress the output of the utility name in front of the normal output line. This can become handy for use in a backquote substitution of a shell command line, see EXAMPLES.

-s

Search for source directories.

-u

Search for “unusual” entries. A file is said to be unusual if it does not have at least one entry of each requested type. Only the name of the unusual entry is printed.

-x

Do not use “expensive” tools when searching for source directories. Normally, after unsuccessfully searching all the first-level subdirectories of the source directory list, whereis will ask locate(1) to find the entry on its behalf. Since this can take much longer, it can be turned off with -x.

Examples

The following finds all utilities under /usr/bin that do not have documentation:

whereis -m -u /usr/bin/*

Change to the source code directory of ls(1):

cd `whereis -sq ls`

Releases

87 releases since FreeBSD 2.0.5-RELEASE; the text changed 44 times.

  1. 2.0.5–2.1.7.1
  2. 2.2.2–2.2.6
  3. 2.2.7–2.2.8
  4. 2.2.9
  5. 3.0–3.2
  6. 3.3–3.5.1
  7. 4.0–4.2
  8. 4.3
  9. 4.4–4.11
  10. 5.0–5.2.1
  11. 5.3–6.3
  12. 6.4
  13. 7.0
  14. 7.1
  15. 7.2
  16. 7.3
  17. 7.4
  18. 8.0
  19. 8.1
  20. 8.2
  21. 8.3
  22. 8.4
  23. 9.0
  24. 9.1
  25. 9.2
  26. 9.3
  27. 10.0
  28. 10.1
  29. 10.2
  30. 10.3
  31. 10.4
  32. 11.0
  33. 11.1
  34. 11.2
  35. 11.3
  36. 11.4
  37. 12.0
  38. 12.1
  39. 12.2
  40. 12.3
  41. 12.4
  42. 13.0–13.2
  43. 13.3–14.5
  44. 15.0–15.1
  45. 16.0

-B since FreeBSD 2.2.2-RELEASE; -M since FreeBSD 2.2.2-RELEASE; -S since FreeBSD 2.2.2-RELEASE; -a since FreeBSD 5.0-RELEASE; -b since FreeBSD 2.2.2-RELEASE; -f since FreeBSD 2.2.2-RELEASE; -m since FreeBSD 2.2.2-RELEASE; -q since FreeBSD 5.0-RELEASE; -s since FreeBSD 2.2.2-RELEASE; -u since FreeBSD 2.2.2-RELEASE; -x since FreeBSD 5.0-RELEASE.

History

The whereis utility appeared in 3.0BSD. This version re-implements the historical functionality that was lost in 4.4BSD.

Authors

This implementation of the whereis command was written by Jörg Wunsch.

Bugs

This re-implementation of the whereis utility is not bug-for-bug compatible with historical versions. It is believed to be compatible with the version that was shipping with FreeBSD 2.2 through FreeBSD 4.5 though.

The whereis utility can report some unrelated source entries when the -a option is specified.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.