xref: /dragonfly/usr.bin/whereis/whereis.1 (revision 1ab20d67)
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. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"	This product includes software developed by the University of
17.\"	California, Berkeley and its contributors.
18.\" 4. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\"	@(#)whereis.1	8.2 (Berkeley) 12/30/93
35.\"
36.\" $FreeBSD: src/usr.bin/whereis/whereis.1,v 1.21 2002/11/26 17:33:36 ru Exp $
37.\" $DragonFly: src/usr.bin/whereis/whereis.1,v 1.3 2004/03/25 16:39:40 drhodus Exp $
38.\"
39.Dd August 22, 2002
40.Dt WHEREIS 1
41.Os
42.Sh NAME
43.Nm whereis
44.Nd locate programs
45.Sh SYNOPSIS
46.Nm
47.Op Fl abmqsux
48.Op Fl BMS Ar dir ... Fl f
49.Ar program ...
50.Sh DESCRIPTION
51The
52.Nm
53utility checks the standard binary, manual page, and source
54directories for the specified programs, printing out the paths of any
55it finds.  The supplied program names are first stripped of leading
56path name components, any single trailing extension added by
57.Xr gzip 1 ,
58.Xr compress 1 ,
59or
60.Xr bzip2 1 ,
61and the leading
62.Ql s.\&
63or trailing
64.Ql ,v
65from a source code control system.
66.Pp
67The default path searched is the string returned by the
68.Xr sysctl 8
69utility for the
70.Dq user.cs_path
71string, with
72.Pa /usr/libexec ,
73.Pa /usr/games
74and the current user's
75.Ev $PATH
76appended.  Manual pages are searched by default along the
77.Ev $MANPATH .
78Program sources are located in a list of known standard places,
79including all the subdirectories of
80.Pa /usr/src
81and
82.Pa /usr/ports .
83.Pp
84The following options are available:
85.Bl -tag -width indent
86.It Fl B
87Specify directories to search for binaries.  Requires the
88.Fl f
89option.
90.It Fl M
91Specify directories to search for manual pages.  Requires the
92.Fl f
93option.
94.It Fl S
95Specify directories to search for program sources.  Requires the
96.Fl f
97option.
98.It Fl a
99Report all matches instead of only the first of each requested type.
100.It Fl b
101Search for binaries.
102.It Fl f
103Delimits the list of directories after the
104.Fl B ,
105.Fl M ,
106or
107.Fl S
108options, and indicates the beginning of the
109.Ar program
110list.
111.It Fl m
112Search for manual pages.
113.It Fl q
114.Pq Dq quiet .
115Suppress the output of the utility name in front of the normal
116output line.
117This can become handy for use in a backquote substitution of a
118shell command line, see
119.Sx EXAMPLES .
120.It Fl s
121Search for source directories.
122.It Fl u
123Search for
124.Dq unusual
125entries.  A 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