Which (Unix)
   HOME

TheInfoList



OR:

In computing, which is a command for various operating systems used to identify the location of
executable In computing, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, causes a computer "to perform indicated tasks according to encoded instruction (computer science), instructi ...
s. The command is available in Unix and Unix-like systems, the
AROS Aros may refer to: *Aros (Middle-earth), a river in J. R. R. Tolkien's Middle-earth legendarium * Aros, Mull, the location of Aros Castle, a ruined 13th-century castle on the Isle of Mull, Scotland *AROS Research Operating System, a free software i ...
shell, for FreeDOS and for
Microsoft Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
. The functionality of the ''which'' command is similar to some implementations of the
type Type may refer to: Science and technology Computing * Typing, producing text via a keyboard, typewriter, etc. * Data type, collection of values used for computations. * File type * TYPE (DOS command), a command to display contents of a file. * Ty ...
command. POSIX specifies a command named command that also covers this functionality.


Implementations


Unix, Unix-like

The command takes one or more arguments; for each of these arguments, it prints the full path of the executable to stdout that would have been executed if this argument had been entered into the shell. It does this by searching for an executable or script in the directories listed in the environment variable PATH. The ''which'' command is part of most Unix-like computers. It is also part of the C Shell. A which command first appeared in
3BSD The History of the Berkeley Software Distribution begins in the 1970s. 1BSD (PDP-11) The earliest distributions of Unix from Bell Labs in the 1970s included the source code to the operating system, allowing researchers at universities to modify an ...
. Carlo Wood developed the GNU implementation used in most Linux-based operating systems. On FreeBSD, the which utility was originally written in Perl by Wolfram Schneider. The current version of which was rewritten by Daniel Papasian using the C programming language.


Microsoft Windows, MS-DOS, FreeDOS

The command is available as a separate package for
Microsoft Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
as part of the GnuWin32 project and the UnxUtils collection of
native Native may refer to: People * Jus soli, citizenship by right of birth * Indigenous peoples, peoples with a set of specific rights based on their historical ties to a particular territory ** Native Americans (disambiguation) In arts and entert ...
Win32 ports of common GNU Unix-like utilities. Windows also includes the similar where.exe command. The same functionality is available in MS-DOS, but not Windows, as the built-in
TRUENAME A true name is a name of a thing or being that expresses, or is somehow identical to, its true nature. The notion that language, or some specific sacred language, refers to things by their true names has been central to philosophical study as we ...
command. In PowerShell, the functionality is provided by the Get-Command Cmdlet. The FreeDOS version was developed by Trane Francks.


AmigaOS compatible

The command is used to find and print the location of a specific program. Inputs: * FILE – Specifies the command to search for * NORES – Resident programs are not included in the search * RES – Only resident programs are considered * ALL – Will find all locations of the FILE, which may cause the printing of the same location several times


References


External links

* * * * {{Unix commands Unix user management and support-related utilities