xref: /freebsd/usr.bin/whereis/whereis.1 (revision bdcbfde31e8e9b343f113a1956384bdf30d1ed62)
19b50d902SRodney W. Grimes.\" Copyright (c) 1993
29b50d902SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
39b50d902SRodney W. Grimes.\"
4e97f67f5SJoerg Wunsch.\" Copyright 2002	Joerg Wunsch
5e97f67f5SJoerg Wunsch.\"
69b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
79b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions
89b50d902SRodney W. Grimes.\" are met:
99b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
109b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
119b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
129b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
139b50d902SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
14dda5b397SEitan Adler.\" 3. Neither the name of the University nor the names of its contributors
159b50d902SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
169b50d902SRodney W. Grimes.\"    without specific prior written permission.
179b50d902SRodney W. Grimes.\"
189b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
199b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
209b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
219b50d902SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
229b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
239b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
249b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
259b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
269b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
279b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
289b50d902SRodney W. Grimes.\" SUCH DAMAGE.
299b50d902SRodney W. Grimes.\"
30eb238d06SJohan Karlsson.Dd August 22, 2002
319b50d902SRodney W. Grimes.Dt WHEREIS 1
3262500372SRuslan Ermilov.Os
339b50d902SRodney W. Grimes.Sh NAME
349b50d902SRodney W. Grimes.Nm whereis
359b50d902SRodney W. Grimes.Nd locate programs
369b50d902SRodney W. Grimes.Sh SYNOPSIS
378fe908efSRuslan Ermilov.Nm
381f05bc6cSJohan Karlsson.Op Fl abmqsux
3906e482e6SRuslan Ermilov.Op Fl BMS Ar dir ... Fl f
408d430958SJohan Karlsson.Ar program ...
419b50d902SRodney W. Grimes.Sh DESCRIPTION
429b50d902SRodney W. GrimesThe
438fe908efSRuslan Ermilov.Nm
44e97f67f5SJoerg Wunschutility checks the standard binary, manual page, and source
45e97f67f5SJoerg Wunschdirectories for the specified programs, printing out the paths of any
466a3e8b0aSRuslan Ermilovit finds.
476a3e8b0aSRuslan ErmilovThe supplied program names are first stripped of leading
48e97f67f5SJoerg Wunschpath name components, any single trailing extension added by
49e97f67f5SJoerg Wunsch.Xr gzip 1 ,
50e97f67f5SJoerg Wunsch.Xr compress 1 ,
51e97f67f5SJoerg Wunschor
52e97f67f5SJoerg Wunsch.Xr bzip2 1 ,
53e97f67f5SJoerg Wunschand the leading
54e97f67f5SJoerg Wunsch.Ql s.\&
55e97f67f5SJoerg Wunschor trailing
56e97f67f5SJoerg Wunsch.Ql ,v
57e97f67f5SJoerg Wunschfrom a source code control system.
589b50d902SRodney W. Grimes.Pp
591ace9012SJoerg WunschThe default path searched is the string returned by the
609b50d902SRodney W. Grimes.Xr sysctl 8
619b50d902SRodney W. Grimesutility for the
629b50d902SRodney W. Grimes.Dq user.cs_path
63e97f67f5SJoerg Wunschstring, with
64*11d9aa67SColin Percival.Pa /usr/libexec
65e97f67f5SJoerg Wunschand the current user's
66e97f67f5SJoerg Wunsch.Ev $PATH
676a3e8b0aSRuslan Ermilovappended.
686a3e8b0aSRuslan ErmilovManual pages are searched by default along the
69e97f67f5SJoerg Wunsch.Ev $MANPATH .
70e97f67f5SJoerg WunschProgram sources are located in a list of known standard places,
71e97f67f5SJoerg Wunschincluding all the subdirectories of
72e97f67f5SJoerg Wunsch.Pa /usr/src
73e97f67f5SJoerg Wunschand
74e97f67f5SJoerg Wunsch.Pa /usr/ports .
75e97f67f5SJoerg Wunsch.Pp
76e97f67f5SJoerg WunschThe following options are available:
77e97f67f5SJoerg Wunsch.Bl -tag -width indent
78e97f67f5SJoerg Wunsch.It Fl B
796a3e8b0aSRuslan ErmilovSpecify directories to search for binaries.
806a3e8b0aSRuslan ErmilovRequires the
81e97f67f5SJoerg Wunsch.Fl f
82e97f67f5SJoerg Wunschoption.
83e97f67f5SJoerg Wunsch.It Fl M
846a3e8b0aSRuslan ErmilovSpecify directories to search for manual pages.
856a3e8b0aSRuslan ErmilovRequires the
86e97f67f5SJoerg Wunsch.Fl f
87e97f67f5SJoerg Wunschoption.
88e97f67f5SJoerg Wunsch.It Fl S
896a3e8b0aSRuslan ErmilovSpecify directories to search for program sources.
906a3e8b0aSRuslan ErmilovRequires the
91e97f67f5SJoerg Wunsch.Fl f
92e97f67f5SJoerg Wunschoption.
931f05bc6cSJohan Karlsson.It Fl a
941f05bc6cSJohan KarlssonReport all matches instead of only the first of each requested type.
95e97f67f5SJoerg Wunsch.It Fl b
96e97f67f5SJoerg WunschSearch for binaries.
97e97f67f5SJoerg Wunsch.It Fl f
98e97f67f5SJoerg WunschDelimits the list of directories after the
99e97f67f5SJoerg Wunsch.Fl B ,
100e97f67f5SJoerg Wunsch.Fl M ,
101e97f67f5SJoerg Wunschor
102e97f67f5SJoerg Wunsch.Fl S
103e97f67f5SJoerg Wunschoptions, and indicates the beginning of the
104e97f67f5SJoerg Wunsch.Ar program
105e97f67f5SJoerg Wunschlist.
106e97f67f5SJoerg Wunsch.It Fl m
107e97f67f5SJoerg WunschSearch for manual pages.
108e97f67f5SJoerg Wunsch.It Fl q
109e97f67f5SJoerg Wunsch.Pq Dq quiet .
110e97f67f5SJoerg WunschSuppress the output of the utility name in front of the normal
111e97f67f5SJoerg Wunschoutput line.
112e97f67f5SJoerg WunschThis can become handy for use in a backquote substitution of a
113e97f67f5SJoerg Wunschshell command line, see
114e97f67f5SJoerg Wunsch.Sx EXAMPLES .
115e97f67f5SJoerg Wunsch.It Fl s
116e97f67f5SJoerg WunschSearch for source directories.
117e97f67f5SJoerg Wunsch.It Fl u
118e97f67f5SJoerg WunschSearch for
119e97f67f5SJoerg Wunsch.Dq unusual
1206a3e8b0aSRuslan Ermiloventries.
1216a3e8b0aSRuslan ErmilovA file is said to be unusual if it does not have at least
1221f05bc6cSJohan Karlssonone entry of each requested type.
123e97f67f5SJoerg WunschOnly the name of the unusual entry is printed.
124e97f67f5SJoerg Wunsch.It Fl x
125e97f67f5SJoerg WunschDo not use
126e97f67f5SJoerg Wunsch.Dq expensive
127e97f67f5SJoerg Wunschtools when searching for source directories.
128e97f67f5SJoerg WunschNormally, after unsuccessfully searching all the first-level
129e97f67f5SJoerg Wunschsubdirectories of the source directory list,
130e97f67f5SJoerg Wunsch.Nm
131e97f67f5SJoerg Wunschwill ask
132e97f67f5SJoerg Wunsch.Xr locate 1
133e97f67f5SJoerg Wunschto find the entry on its behalf.
134e97f67f5SJoerg WunschSince this can take much longer, it can be turned off with
135e97f67f5SJoerg Wunsch.Fl x .
136e97f67f5SJoerg Wunsch.El
137e97f67f5SJoerg Wunsch.Sh EXAMPLES
138e97f67f5SJoerg WunschThe following finds all utilities under
139e97f67f5SJoerg Wunsch.Pa /usr/bin
140e97f67f5SJoerg Wunschthat do not have documentation:
141e97f67f5SJoerg Wunsch.Pp
142e97f67f5SJoerg Wunsch.Dl whereis -m -u /usr/bin/*
143e97f67f5SJoerg Wunsch.Pp
144e97f67f5SJoerg WunschChange to the source code directory of
145e97f67f5SJoerg Wunsch.Xr ls 1 :
146e97f67f5SJoerg Wunsch.Pp
147e97f67f5SJoerg Wunsch.Dl cd `whereis -sq ls`
1489b50d902SRodney W. Grimes.Sh SEE ALSO
149e97f67f5SJoerg Wunsch.Xr find 1 ,
150e97f67f5SJoerg Wunsch.Xr locate 1 ,
151e97f67f5SJoerg Wunsch.Xr man 1 ,
152acd80190SWolfram Schneider.Xr which 1 ,
1531ace9012SJoerg Wunsch.Xr sysctl 8
1549b50d902SRodney W. Grimes.Sh HISTORY
1559b50d902SRodney W. GrimesThe
1568fe908efSRuslan Ermilov.Nm
157084e1980SPhilippe Charnierutility appeared in
1581ace9012SJoerg Wunsch.Bx 3.0 .
159e97f67f5SJoerg WunschThis version re-implements the historical
160e97f67f5SJoerg Wunschfunctionality that was lost in
161e97f67f5SJoerg Wunsch.Bx 4.4 .
162e97f67f5SJoerg Wunsch.Sh AUTHORS
163e97f67f5SJoerg WunschThis implementation of the
164e97f67f5SJoerg Wunsch.Nm
165e97f67f5SJoerg Wunschcommand was written by
166e97f67f5SJoerg Wunsch.An J\(:org Wunsch .
167e97f67f5SJoerg Wunsch.Sh BUGS
168e97f67f5SJoerg WunschThis re-implementation of the
169e97f67f5SJoerg Wunsch.Nm
170e97f67f5SJoerg Wunschutility is not bug-for-bug compatible with historical versions.
171e97f67f5SJoerg WunschIt is believed to be compatible with the version that was shipping with
172e97f67f5SJoerg Wunsch.Fx 2.2
173e97f67f5SJoerg Wunschthrough
174e97f67f5SJoerg Wunsch.Fx 4.5
175e97f67f5SJoerg Wunschthough.
1761f05bc6cSJohan Karlsson.Pp
1771f05bc6cSJohan KarlssonThe
1781f05bc6cSJohan Karlsson.Nm
1791f05bc6cSJohan Karlssonutility can report some unrelated source entries when the
1801f05bc6cSJohan Karlsson.Fl a
1811f05bc6cSJohan Karlssonoption is specified.
182