xref: /dragonfly/usr.bin/whereis/whereis.1 (revision 3170ffd7)
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.\" 4. 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: src/usr.bin/whereis/whereis.1,v 1.21 2002/11/26 17:33:36 ru Exp $
33.\" $DragonFly: src/usr.bin/whereis/whereis.1,v 1.6 2007/07/14 21:48:16 swildner Exp $
34.\"
35.Dd July 1, 2006
36.Dt WHEREIS 1
37.Os
38.Sh NAME
39.Nm whereis
40.Nd locate programs
41.Sh SYNOPSIS
42.Nm
43.Op Fl abmqsux
44.Op Fl BMS Ar dir ... Fl f
45.Ar program ...
46.Sh DESCRIPTION
47The
48.Nm
49utility checks the standard binary, manual page, and source
50directories for the specified programs, printing out the paths of any
51it finds.
52The supplied program names are first stripped of leading
53path name components, any single trailing extension added by
54.Xr gzip 1 ,
55.Xr compress 1 ,
56or
57.Xr bzip2 1 ,
58and the leading
59.Ql s.\&
60or trailing
61.Ql ,v
62from a source code control system.
63.Pp
64The default path searched is the string returned by the
65.Xr sysctl 8
66utility for the
67.Va user.cs_path
68string, with
69.Pa /usr/libexec ,
70.Pa /usr/games
71and the current user's
72.Ev $PATH
73appended.
74Manual pages are searched by default along the
75.Ev $MANPATH .
76Program sources are located in a list of known standard places,
77including all the subdirectories of
78.Pa /usr/src
79and
80.Pa /usr/pkgsrc .
81.Pp
82The following options are available:
83.Bl -tag -width indent
84.It Fl B
85Specify directories to search for binaries.
86Requires the
87.Fl f
88option.
89.It Fl M
90Specify directories to search for manual pages.
91Requires 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.
126A file is said to be unusual if it does not have at least
127one entry of each requested type.
128Only the name of the unusual entry is printed.
129.It Fl x
130Do not use
131.Dq expensive
132tools when searching for source directories.
133Normally, after unsuccessfully searching all the first-level
134subdirectories of the source directory list,
135.Nm
136will ask
137.Xr locate 1
138to find the entry on its behalf.
139Since this can take much longer, it can be turned off with
140.Fl x .
141.El
142.Sh EXAMPLES
143The following finds all utilities under
144.Pa /usr/bin
145that do not have documentation:
146.Pp
147.Dl whereis -m -u /usr/bin/*
148.Pp
149Change to the source code directory of
150.Xr ls 1 :
151.Pp
152.Dl cd `whereis -sq ls`
153.Sh SEE ALSO
154.Xr find 1 ,
155.Xr locate 1 ,
156.Xr man 1 ,
157.Xr which 1 ,
158.Xr sysctl 8
159.Sh HISTORY
160The
161.Nm
162utility appeared in
163.Bx 3.0 .
164This version re-implements the historical
165functionality that was lost in
166.Bx 4.4 .
167.Sh AUTHORS
168This implementation of the
169.Nm
170command was written by
171.An J\(:org Wunsch .
172.Sh BUGS
173This re-implementation of the
174.Nm
175utility is not bug-for-bug compatible with historical versions.
176It is believed to be compatible with the version that was shipping with
177.Fx 2.2
178through
179.Fx 4.5
180though.
181.Pp
182The
183.Nm
184utility can report some unrelated source entries when the
185.Fl a
186option is specified.
187