]> git.ipfire.org Git - thirdparty/util-linux.git/blame - misc-utils/whereis.1
logger: fix memory leaks
[thirdparty/util-linux.git] / misc-utils / whereis.1
CommitLineData
6dbe3af9
KZ
1.\" Copyright (c) 1980, 1990 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\" must display the following acknowledgement:
14.\" This product includes software developed by the University of
15.\" California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)whereis.1 from UCB 4.2
2e6f289a 33.TH WHEREIS 1 "October 2014" "util-linux" "User Commands"
6dbe3af9
KZ
34.SH NAME
35whereis \- locate the binary, source, and manual page files for a command
36.SH SYNOPSIS
37.B whereis
f49ccec2 38[options]
fd5ccc69 39.RB [ \-BMS
2e1d40c6
BS
40.IR directory "... " \fB\-f\fR ]
41.IR name ...
6dbe3af9
KZ
42.SH DESCRIPTION
43.B whereis
2e1d40c6 44locates the binary, source and manual files for the specified command names.
d6590ebd
SK
45The supplied names are first stripped of leading pathname components and any
46(single) trailing extension of the form
2e1d40c6
BS
47.BI . ext
48(for example:
49.BR .c )
6dbe3af9
KZ
50Prefixes of
51.B s.
52resulting from use of source code control are also dealt with.
53.B whereis
d6590ebd
SK
54then attempts to locate the desired program in the standard Linux places, and
55in the places specified by
56.B $PATH
57and
58.BR $MANPATH .
2e6f289a
BS
59.sp
60The search restrictions (options \fB\-b\fP, \fB\-m\fP and \fB\-s\fP)
61are cumulative and apply to the subsequent \fIname\fP patterns on
62the command line. Any new search restriction resets the search mask.
63For example,
f4802c90
KZ
64.RS
65.sp
66.B "whereis -bm ls tr -m gcc"
67.sp
68.RE
2e6f289a
BS
69searches for "ls" and "tr" binaries and man pages, and for "gcc" man pages only.
70.sp
71The options \fB\-B\fP, \fB\-M\fP and \fB\-S\fP reset search paths for the
72subsequent \fIname\fP patterns. For example,
f4802c90
KZ
73.RS
74.sp
75.B "whereis -m ls -M /usr/share/man/man1 -f cal"
76.sp
77.RE
2e6f289a
BS
78searches for "ls" man pages in all default paths, but for "cal" in
79the /usr/share/man/man1 directory only.
f4802c90 80
6dbe3af9
KZ
81.SH OPTIONS
82.TP
d6590ebd 83.IP \fB\-b\fP
f4802c90 84Search for binaries.
d6590ebd 85.IP \fB\-m\fP
f4802c90 86Search for manuals.
d6590ebd 87.IP \fB\-s\fP
f4802c90 88Search for sources.
d6590ebd
SK
89.IP \fB\-u\fP
90Only show the command names that have unusual entries. A command is said to be
91unusual if it does not have just one entry of each explicitly requested type.
92Thus
93.RB ' "whereis \-m \-u *" '
94asks for those files in the current directory which have no documentation file,
95or more than one.
25206ba6 96.IP "\fB\-B \fIlist\fP"
2e1d40c6 97Limit the places where
6dbe3af9 98.B whereis
2e1d40c6 99searches for binaries, by a whitespace-separated list of directories.
25206ba6 100.IP "\fB\-M \fIlist\fP"
2e1d40c6 101Limit the places where
6dbe3af9 102.B whereis
db0ccb76
KZ
103searches for manuals and documentation in Info format, by a
104whitespace-separated list of directories.
25206ba6 105.IP "\fB\-S \fIlist\fP"
2e1d40c6 106Limit the places where
6dbe3af9 107.B whereis
2e1d40c6 108searches for sources, by a whitespace-separated list of directories.
25206ba6 109.IP "\fB\-f\fP"
2e1d40c6 110Terminates the directory list and signals the start of filenames. It
6dbe3af9
KZ
111.I must
112be used when any of the
113.BR \-B ,
114.BR \-M ,
115or
ddfc5ed6 116.BR \-S
2e1d40c6 117options is used.
3bfb9636 118.IP "\fB\-l"
2e6f289a 119Output the list of effective lookup paths that
3bfb9636 120.B whereis
2e6f289a 121is using. When none of
3bfb9636
SK
122.BR \-B ,
123.BR \-M ,
124or
125.BR \-S
2e6f289a
BS
126is specified, the option will output the hard-coded paths
127that the command was able to find on the system.
6dbe3af9 128.SH EXAMPLE
2e1d40c6 129To find all files in
d6590ebd 130.B /usr/\:bin
6dbe3af9
KZ
131which are not documented
132in
d6590ebd 133.B /usr/\:man/\:man1
2e1d40c6 134or have no source in
d6590ebd 135.BR /usr/\:src :
6dbe3af9 136.IP
2e6f289a 137.B cd /usr/bin
2e1d40c6 138.br
2e6f289a 139.B whereis \-u \-ms \-M /usr/man/man1 \-S /usr/src \-f *
ccec32a1
SK
140.SH "FILE SEARCH PATHS"
141By default
25206ba6 142.B whereis
ccec32a1 143tries to find files from hard-coded paths, which are defined with glob
2e6f289a 144patterns. The command attempst to use contents of
25206ba6 145.B $PATH
ccec32a1
SK
146and
147.B $MANPATH
148environment variables as default search path. The easiest way to know
149what paths are in use is to add
150.B \-l
151listing option. Effects of the
152.BR \-B ,
153.BR \-M ,
154and
155.BR \-S
156are display with
157.BR \-l .
2b6fc908 158.PP
47dd6918
KZ
159.SH ENVIRONMENT
160.IP WHEREIS_DEBUG=all
161enables debug output.
86d62711 162.SH AVAILABILITY
601d12fb 163The whereis command is part of the util-linux package and is available from
d6590ebd
SK
164.UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
165Linux Kernel Archive
166.UE .