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