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