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
47 command is said to be unusual if it does not have just
48 one entry of each explicitly requested type. Thus
49 'whereis -m -u *' asks for those files in the current
50 directory which have no documentation file, or more than
51 one.
52
53 -B list
54 Limit the places where whereis searches for binaries, by
55 a whitespace-separated list of directories.
56
57 -M list
58 Limit the places where whereis searches for manuals and
59 documentation in Info format, by a whitespace-separated
60 list of directories.
61
62 -S list
63 Limit the places where whereis searches for sources, by a
64 whitespace-separated list of directories.
65
66 -f Terminates the directory list and signals the start of
67 filenames. It must be used when any of the -B, -M, or -S
68 options is used.
69
70 -l Output the list of effective lookup paths that whereis is
71 using. When none of -B, -M, or -S is specified, the
72 option will output the hard-coded paths that the command
73 was able to find on the system.
74
75 -h, --help
76 Display help text and exit.
77
78 -V, --version
79 Display version information and exit.
80
82 To find all files in /usr/bin which are not documented in /usr/
83 man/man1 or have no source in /usr/src:
84
85 cd /usr/bin
86 whereis -u -ms -M /usr/man/man1 -S /usr/src -f *
87
89 By default whereis tries to find files from hard-coded paths,
90 which are defined with glob patterns. The command attempts to
91 use the contents of $PATH and $MANPATH environment variables as
92 default search path. The easiest way to know what paths are in
93 use is to add the -l listing option. Effects of the -B, -M, and
94 -S are displayed with -l.
95
97 WHEREIS_DEBUG=all
98 enables debug output.
99
101 The whereis command is part of the util-linux package and is
102 available from Linux Kernel Archive ⟨https://www.kernel.org/pub
103 /linux/utils/util-linux/⟩.
104
105
106
107util-linux October 2014 WHEREIS(1)