xref: /freebsd/usr.bin/whereis/whereis.1 (revision e627b39baccd1ec9129690167cf5e6d860509655)
1.\" Copyright (c) 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\"    must display the following acknowledgement:
14.\"	This product includes software developed by the University of
15.\"	California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"	@(#)whereis.1	8.2 (Berkeley) 12/30/93
33.\"
34.\" $Id$
35.\"
36.Dd June 15, 1996
37.Dt WHEREIS 1
38.Os FreeBSD
39.Sh NAME
40.Nm whereis
41.Nd locate programs
42.Sh SYNOPSIS
43.Nm whereis
44.Op Fl bms
45.Op Fl u
46.Op Fl BMS dir ... Fl f
47.Ar program ...
48.Sh DESCRIPTION
49The
50.Nm whereis
51utility checks the standard binary, manual page, and source
52directories for the specified programs, printing out the paths of any
53it finds.  The supplied names are first stripped of leading path name
54components, any single trailing extension of the form
55.Ql .ext ,
56and the leading
57.Ql s.
58or trailing
59.Ql ,v
60from a source code control system.
61.Pp
62The default path searched is the string returned by the
63.Xr sysctl 8
64utility for the
65.Dq user.cs_path
66string, with
67.Pa /usr/libexec
68and the current user's
69.Ev $PATH
70appended.  Manual 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.  Requires the
82.Fl f
83option.
84.It Fl M
85Specify directories to search for manual pages.  Requires the
86.Fl f
87option.
88.It Fl S
89Specify directories to search for program sources.  Requires the
90.Fl f
91option.
92.It Fl b
93Search for binaries.
94.It Fl f
95Delimits the list of directories after the
96.Fl B ,
97.Fl M ,
98or
99.Fl S
100options, and indicates the beginning of the
101.Ar name
102list.
103.It Fl m
104Search for manual pages.
105.It Fl s
106Search for source directories.
107.It Fl u
108Search for
109.Dq unusual
110entries.  A file is said to be unusual if it does not have one entry
111of each requested type.
112.El
113.Sh EXAMPLE
114The following finds all utilities under
115.Pa /usr/bin
116that do not have documentation:
117.Dl whereis -m -u /usr/bin/*
118.Sh SEE ALSO
119.Xr locate 1 ,
120.Xr man 1 ,
121.Xr sysctl 8
122.Sh BUGS
123The search for sources is implemented as a quick search as the
124first-level subdirectory of each element of the list of source
125directories first.  If this didn't succeed, the utility
126.Xr locate 1
127is requested to do the search in deeper nested subdirectories.  This
128might take some time, and will only succeed if the locate database is
129up-to-date.
130.Sh HISTORY
131The
132.Nm whereis
133command appeared in
134.Bx 3.0 .
135This version re-implements the historical
136functionality that was lost in
137.Bx 4.4 .
138