xref: /freebsd/usr.bin/whereis/whereis.1 (revision eb69d1f144a6fcc765d1b9d44a5ae8082353e70b)
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.\"	@(#)whereis.1	8.2 (Berkeley) 12/30/93
31.\"
32.\" $FreeBSD$
33.\"
34.Dd August 22, 2002
35.Dt WHEREIS 1
36.Os
37.Sh NAME
38.Nm whereis
39.Nd locate programs
40.Sh SYNOPSIS
41.Nm
42.Op Fl abmqsux
43.Op Fl BMS Ar dir ... Fl f
44.Ar program ...
45.Sh DESCRIPTION
46The
47.Nm
48utility checks the standard binary, manual page, and source
49directories for the specified programs, printing out the paths of any
50it finds.
51The supplied program names are first stripped of leading
52path name components, any single trailing extension added by
53.Xr gzip 1 ,
54.Xr compress 1 ,
55or
56.Xr bzip2 1 ,
57and the leading
58.Ql s.\&
59or trailing
60.Ql ,v
61from a source code control system.
62.Pp
63The default path searched is the string returned by the
64.Xr sysctl 8
65utility for the
66.Dq user.cs_path
67string, with
68.Pa /usr/libexec
69and the current user's
70.Ev $PATH
71appended.
72Manual pages are searched by default along the
73.Ev $MANPATH .
74Program sources are located in a list of known standard places,
75including all the subdirectories of
76.Pa /usr/src
77and
78.Pa /usr/ports .
79.Pp
80The following options are available:
81.Bl -tag -width indent
82.It Fl B
83Specify directories to search for binaries.
84Requires the
85.Fl f
86option.
87.It Fl M
88Specify directories to search for manual pages.
89Requires the
90.Fl f
91option.
92.It Fl S
93Specify directories to search for program sources.
94Requires the
95.Fl f
96option.
97.It Fl a
98Report all matches instead of only the first of each requested type.
99.It Fl b
100Search for binaries.
101.It Fl f
102Delimits the list of directories after the
103.Fl B ,
104.Fl M ,
105or
106.Fl S
107options, and indicates the beginning of the
108.Ar program
109list.
110.It Fl m
111Search for manual pages.
112.It Fl q
113.Pq Dq quiet .
114Suppress the output of the utility name in front of the normal
115output line.
116This can become handy for use in a backquote substitution of a
117shell command line, see
118.Sx EXAMPLES .
119.It Fl s
120Search for source directories.
121.It Fl u
122Search for
123.Dq unusual
124entries.
125A file is said to be unusual if it does not have at least
126one entry of each requested type.
127Only the name of the unusual entry is printed.
128.It Fl x
129Do not use
130.Dq expensive
131tools when searching for source directories.
132Normally, after unsuccessfully searching all the first-level
133subdirectories of the source directory list,
134.Nm
135will ask
136.Xr locate 1
137to find the entry on its behalf.
138Since this can take much longer, it can be turned off with
139.Fl x .
140.El
141.Sh EXAMPLES
142The following finds all utilities under
143.Pa /usr/bin
144that do not have documentation:
145.Pp
146.Dl whereis -m -u /usr/bin/*
147.Pp
148Change to the source code directory of
149.Xr ls 1 :
150.Pp
151.Dl cd `whereis -sq ls`
152.Sh SEE ALSO
153.Xr find 1 ,
154.Xr locate 1 ,
155.Xr man 1 ,
156.Xr which 1 ,
157.Xr sysctl 8
158.Sh HISTORY
159The
160.Nm
161utility appeared in
162.Bx 3.0 .
163This version re-implements the historical
164functionality that was lost in
165.Bx 4.4 .
166.Sh AUTHORS
167This implementation of the
168.Nm
169command was written by
170.An J\(:org Wunsch .
171.Sh BUGS
172This re-implementation of the
173.Nm
174utility is not bug-for-bug compatible with historical versions.
175It is believed to be compatible with the version that was shipping with
176.Fx 2.2
177through
178.Fx 4.5
179though.
180.Pp
181The
182.Nm
183utility can report some unrelated source entries when the
184.Fl a
185option is specified.
186