which (command)
In computing, which
is a command for various operating systems used to identify the location of executables. The command is available in Unix and Unix-like systems, the AROS shell,[5] for FreeDOS[6] and for Microsoft Windows.[2] The functionality of the which command is similar to some implementations of the type command. POSIX specifies a command named command that also covers this functionality.[7]
Developer(s) | Carlo Wood |
---|---|
Stable release | 2.21[1]
/ March 20, 2015 |
Operating system | Unix, Unix-like, Microsoft Windows[2] |
Type | Command |
License | GNU GPL v3 |
Website | carlowood.github.io |
Developer(s) | Trane Francks |
---|---|
Stable release | 2.1[3]
/ March 20, 2002 |
Operating system | FreeDOS |
Type | Command |
License | GNU GPL v2 |
Website | Trane's World: Reinvented |
Operating system | AROS Research Operating System |
---|---|
Type | Command |
License | AROS Public License (APL) Version 1.1 (based on the MPL)[4] |
Website | aros.sourceforge.net |
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.[8] The which command is part of most Unix-like computers. It is also part of the C Shell.[7]
Microsoft Windows, MS-DOS, FreeDOS
The command is available as a separate package for Microsoft Windows as part of the GnuWin32 project[2] and the UnxUtils collection of native Win32 ports of common GNU Unix-like utilities.[9] Windows also includes the similar where.exe
command.
The same functionality is available in MS-DOS, but not Windows, as the built-in TRUENAME command.
In PowerShell, the functionality is provided by the Get-Command Cmdlet.[10]
AROS Research Operating System
The command is used to find and print the location of a specific program.[12]
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
- https://carlowood.github.io/which/
-
which
for Windows from the GnuWin32 project - http://www2.gol.com/users/trane/Tranes_World__Reinvented/Programming.html
- http://aros.sourceforge.net/license.html
- http://aros.sourceforge.net/documentation/users/shell/index.php
- http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/pkg-html/group-util.html
- "Command", The Open group base specification, Issue 7, IEEE std 1003.1-2008
-
which
man page - http://unxutils.sourceforge.net/
- https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/get-command?view=powershell-3.0
- http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/pkg-html/which.html
- http://aros.sourceforge.net/documentation/users/shell/which.php