1WHEREIS(1) User Commands WHEREIS(1)
2
3
4
6 whereis - locate the binary, source, and manual page files for a com‐
7 mand
8
10 whereis [options] [-BMS directory... -f] name...
11
13 whereis locates the binary, source and manual files for the specified
14 command names. The supplied names are first stripped of leading path‐
15 name components and any (single) trailing extension of the form .ext
16 (for example: .c) Prefixes of s. resulting from use of source code
17 control are also dealt with. whereis then attempts to locate the
18 desired program in the standard Linux places, and in the places speci‐
19 fied by $PATH and $MANPATH.
20
21 The search restrictions (options -b, -m and -s) are cumulative and
22 apply to the subsequent name patterns on the command line. Any new
23 search restriction resets the search mask. For example,
24
25 whereis -bm ls tr -m gcc
26
27 searches for "ls" and "tr" binaries and man pages, and for "gcc" man
28 pages only.
29
30 The options -B, -M and -S reset search paths for the subsequent name
31 patterns. For example,
32
33 whereis -m ls -M /usr/share/man/man1 -f cal
34
35 searches for "ls" man pages in all default paths, but for "cal" in the
36 /usr/share/man/man1 directory only.
37
38
40 -b Search for binaries.
41
42 -m Search for manuals.
43
44 -s Search for sources.
45
46 -u Only show the command names that have unusual entries. A com‐
47 mand is said to be unusual if it does not have just one entry of
48 each explicitly requested type. Thus 'whereis -m -u *' asks for
49 those files in the current directory which have no documentation
50 file, or more than one.
51
52 -B list
53 Limit the places where whereis searches for binaries, by a
54 whitespace-separated list of directories.
55
56 -M list
57 Limit the places where whereis searches for manuals and documen‐
58 tation in Info format, by a whitespace-separated list of direc‐
59 tories.
60
61 -S list
62 Limit the places where whereis searches for sources, by a white‐
63 space-separated list of directories.
64
65 -f Terminates the directory list and signals the start of file‐
66 names. It must be used when any of the -B, -M, or -S options is
67 used.
68
69 -l Output the list of effective lookup paths that whereis is using.
70 When none of -B, -M, or -S is specified, the option will output
71 the hard-coded paths that the command was able to find on the
72 system.
73
74 -h, --help
75 Display help text and exit.
76
77 -V, --version
78 Display version information and exit.
79
81 By default whereis tries to find files from hard-coded paths, which are
82 defined with glob patterns. The command attempts to use the contents
83 of $PATH and $MANPATH environment variables as default search path.
84 The easiest way to know what paths are in use is to add the -l listing
85 option. Effects of the -B, -M, and -S are displayed with -l.
86
88 WHEREIS_DEBUG=all
89 enables debug output.
90
92 To find all files in /usr/bin which are not documented in /usr/man/man1
93 or have no source in /usr/src:
94
95 cd /usr/bin
96 whereis -u -ms -M /usr/man/man1 -S /usr/src -f *
97
99 The whereis command is part of the util-linux package and is available
100 from Linux Kernel Archive ⟨https://www.kernel.org/pub/linux/utils/util-
101 linux/⟩.
102
103
104
105util-linux October 2014 WHEREIS(1)