xref: /freebsd/usr.bin/whereis/whereis.1 (revision e0c4386e)
1.\" Copyright (c) 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Copyright 2002	Joerg Wunsch
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.Dd August 22, 2002
31.Dt WHEREIS 1
32.Os
33.Sh NAME
34.Nm whereis
35.Nd locate programs
36.Sh SYNOPSIS
37.Nm
38.Op Fl abmqsux
39.Op Fl BMS Ar dir ... Fl f
40.Ar program ...
41.Sh DESCRIPTION
42The
43.Nm
44utility checks the standard binary, manual page, and source
45directories for the specified programs, printing out the paths of any
46it finds.
47The supplied program names are first stripped of leading
48path name components, any single trailing extension added by
49.Xr gzip 1 ,
50.Xr compress 1 ,
51or
52.Xr bzip2 1 ,
53and the leading
54.Ql s.\&
55or trailing
56.Ql ,v
57from a source code control system.
58.Pp
59The default path searched is the string returned by the
60.Xr sysctl 8
61utility for the
62.Dq user.cs_path
63string, with
64.Pa /usr/libexec
65and the current user's
66.Ev $PATH
67appended.
68Manual pages are searched by default along the
69.Ev $MANPATH .
70Program sources are located in a list of known standard places,
71including all the subdirectories of
72.Pa /usr/src
73and
74.Pa /usr/ports .
75.Pp
76The following options are available:
77.Bl -tag -width indent
78.It Fl B
79Specify directories to search for binaries.
80Requires the
81.Fl f
82option.
83.It Fl M
84Specify directories to search for manual pages.
85Requires the
86.Fl f
87option.
88.It Fl S
89Specify directories to search for program sources.
90Requires the
91.Fl f
92option.
93.It Fl a
94Report all matches instead of only the first of each requested type.
95.It Fl b
96Search for binaries.
97.It Fl f
98Delimits the list of directories after the
99.Fl B ,
100.Fl M ,
101or
102.Fl S
103options, and indicates the beginning of the
104.Ar program
105list.
106.It Fl m
107Search for manual pages.
108.It Fl q
109.Pq Dq quiet .
110Suppress the output of the utility name in front of the normal
111output line.
112This can become handy for use in a backquote substitution of a
113shell command line, see
114.Sx EXAMPLES .
115.It Fl s
116Search for source directories.
117.It Fl u
118Search for
119.Dq unusual
120entries.
121A file is said to be unusual if it does not have at least
122one entry of each requested type.
123Only the name of the unusual entry is printed.
124.It Fl x
125Do not use
126.Dq expensive
127tools when searching for source directories.
128Normally, after unsuccessfully searching all the first-level
129subdirectories of the source directory list,
130.Nm
131will ask
132.Xr locate 1
133to find the entry on its behalf.
134Since this can take much longer, it can be turned off with
135.Fl x .
136.El
137.Sh EXAMPLES
138The following finds all utilities under
139.Pa /usr/bin
140that do not have documentation:
141.Pp
142.Dl whereis -m -u /usr/bin/*
143.Pp
144Change to the source code directory of
145.Xr ls 1 :
146.Pp
147.Dl cd `whereis -sq ls`
148.Sh SEE ALSO
149.Xr find 1 ,
150.Xr locate 1 ,
151.Xr man 1 ,
152.Xr which 1 ,
153.Xr sysctl 8
154.Sh HISTORY
155The
156.Nm
157utility appeared in
158.Bx 3.0 .
159This version re-implements the historical
160functionality that was lost in
161.Bx 4.4 .
162.Sh AUTHORS
163This implementation of the
164.Nm
165command was written by
166.An J\(:org Wunsch .
167.Sh BUGS
168This re-implementation of the
169.Nm
170utility is not bug-for-bug compatible with historical versions.
171It is believed to be compatible with the version that was shipping with
172.Fx 2.2
173through
174.Fx 4.5
175though.
176.Pp
177The
178.Nm
179utility can report some unrelated source entries when the
180.Fl a
181option is specified.
182