xref: /freebsd/usr.bin/which/which.1 (revision 2b7af31cf5e70677f52214702a95d4225564c52d)
1c5e7e03aSRuslan Ermilov.\" Manpage Copyright (c) 1995, Jordan Hubbard <jkh@FreeBSD.org>
29d6b1253SJordan K. Hubbard.\"
39d6b1253SJordan K. Hubbard.\" Redistribution and use in source and binary forms, with or without
49d6b1253SJordan K. Hubbard.\" modification, are permitted provided that the following conditions
59d6b1253SJordan K. Hubbard.\" are met:
69d6b1253SJordan K. Hubbard.\" 1. Redistributions of source code must retain the above copyright
79d6b1253SJordan K. Hubbard.\"    notice, this list of conditions and the following disclaimer.
89d6b1253SJordan K. Hubbard.\" 2. Redistributions in binary form must reproduce the above copyright
99d6b1253SJordan K. Hubbard.\"    notice, this list of conditions and the following disclaimer in the
109d6b1253SJordan K. Hubbard.\"    documentation and/or other materials provided with the distribution.
119d6b1253SJordan K. Hubbard.\" 3. All advertising materials mentioning features or use of this software
129d6b1253SJordan K. Hubbard.\"    must display the following acknowledgement:
139d6b1253SJordan K. Hubbard.\"      This product includes software developed by the FreeBSD Project
149d6b1253SJordan K. Hubbard.\"      its contributors.
159d6b1253SJordan K. Hubbard.\" 4. Neither the name of the FreeBSD Project nor the names of its contributors
169d6b1253SJordan K. Hubbard.\"    may be used to endorse or promote products derived from this software
179d6b1253SJordan K. Hubbard.\"    without specific prior written permission.
183819b413SWolfram Schneider.\"
199d6b1253SJordan K. Hubbard.\" THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTOR ``AS IS'' AND ANY EXPRESS OR
209d6b1253SJordan K. Hubbard.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
219d6b1253SJordan K. Hubbard.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
229d6b1253SJordan K. Hubbard.\" IN NO EVENT SHALL THE CONTRIBUTOR BE LIABLE FOR ANY DIRECT, INDIRECT,
239d6b1253SJordan K. Hubbard.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
249d6b1253SJordan K. Hubbard.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
259d6b1253SJordan K. Hubbard.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
269d6b1253SJordan K. Hubbard.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
279d6b1253SJordan K. Hubbard.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
289d6b1253SJordan K. Hubbard.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
299d6b1253SJordan K. Hubbard.\"
30c3aac50fSPeter Wemm.\" $FreeBSD$
31ea2a88d9SRuslan Ermilov.\"
32531ab78aSRuslan Ermilov.Dd December 13, 2006
339d6b1253SJordan K. Hubbard.Dt WHICH 1
3462500372SRuslan Ermilov.Os
359d6b1253SJordan K. Hubbard.Sh NAME
369d6b1253SJordan K. Hubbard.Nm which
379d6b1253SJordan K. Hubbard.Nd "locate a program file in the user's path"
389d6b1253SJordan K. Hubbard.Sh SYNOPSIS
398fe908efSRuslan Ermilov.Nm
4035bff0b9SSatoshi Asami.Op Fl as
41b7a311f2SRuslan Ermilov.Ar program ...
429d6b1253SJordan K. Hubbard.Sh DESCRIPTION
43e8937ba0SPhilippe CharnierThe
44e8937ba0SPhilippe Charnier.Nm
45e8937ba0SPhilippe Charnierutility
469d6b1253SJordan K. Hubbardtakes a list of command names and searches the path for each executable
479d6b1253SJordan K. Hubbardfile that would be run had these commands actually been invoked.
4835bff0b9SSatoshi Asami.Pp
4935bff0b9SSatoshi AsamiThe following options are available:
5035bff0b9SSatoshi Asami.Bl -tag -width indent
5135bff0b9SSatoshi Asami.It Fl a
5235bff0b9SSatoshi AsamiList all instances of executables found (instead of just the first one
5335bff0b9SSatoshi Asamiof each).
5435bff0b9SSatoshi Asami.It Fl s
55531ab78aSRuslan ErmilovNo output, just return 0 if all of the executables are found, or 1 if
5622ae0cecSRuslan Ermilovsome were not found.
5721a6eb09SSheldon Hearn.El
58c644db6aSSheldon Hearn.Pp
59c644db6aSSheldon HearnSome shells may provide a builtin
60c644db6aSSheldon Hearn.Nm
61e6d3cf26SSheldon Hearncommand which is similar or identical to this utility.
62e6d3cf26SSheldon HearnConsult the
63c644db6aSSheldon Hearn.Xr builtin 1
64c644db6aSSheldon Hearnmanual page.
659d6b1253SJordan K. Hubbard.Sh SEE ALSO
66c644db6aSSheldon Hearn.Xr builtin 1 ,
67c644db6aSSheldon Hearn.Xr csh 1 ,
6841cbb624SJoseph Koshy.Xr find 1 ,
6941cbb624SJoseph Koshy.Xr locate 1 ,
706a34c725SJoseph Koshy.Xr whereis 1
716c7216dfSRuslan Ermilov.Sh HISTORY
726c7216dfSRuslan ErmilovThe
736c7216dfSRuslan Ermilov.Nm
746c7216dfSRuslan Ermilovcommand first appeared in
756c7216dfSRuslan Ermilov.Fx 2.1 .
76306005e7SPhilippe Charnier.Sh AUTHORS
77ea2a88d9SRuslan Ermilov.An -nosplit
78ea2a88d9SRuslan ErmilovThe
7993a35425SPhilippe Charnier.Nm
80ea2a88d9SRuslan Ermilovutility was originally written in Perl and was contributed by
81*2b7af31cSBaptiste Daroussin.An Wolfram Schneider Aq Mt wosch@FreeBSD.org .
82ea2a88d9SRuslan ErmilovThe current version of
83ea2a88d9SRuslan Ermilov.Nm
84ea2a88d9SRuslan Ermilovwas rewritten in C by
85*2b7af31cSBaptiste Daroussin.An Daniel Papasian Aq Mt dpapasia@andrew.cmu.edu .
86