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