Which (command) explained

which
Developer:Carlo Wood, Daniel Papasian, Trane Francks
Latest Release Version:
Operating System:Unix, Unix-like, Microsoft Windows, FreeBSD, FreeDOS, AROS Research Operating System[1]
Genre:Command
License:coreutils

GNU GPL v3, BusyBox: BSD, FreeDOS: GNU GPLv2, AROS: AROS Public License (APL) Version 1.1 (based on the MPL)[2]

Website:GNU:, FreeDOS:Trane's World: Reinvented, AROS: aros.sourceforge.net

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,[3] for FreeDOS[4] and for Microsoft Windows. 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.

Implementations

Unix, Unix-like, Multics

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.[5] 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.

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.

Multics uses the command where abbreviated as wh.

Microsoft Windows, MS-DOS, FreeDOS

The command is available as a separate package for Microsoft Windows as part of the GnuWin32 project and the UnxUtils collection of native Win32 ports of common GNU Unix-like utilities.[6] 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.[7]

The FreeDOS version was developed by Trane Francks.[8]

AmigaOS compatible

The command is used to find and print the location of a specific program.[9]

Inputs:

References

  1. http://gnuwin32.sourceforge.net/packages/which.htm which for Windows
  2. Web site: AROS Public License version 1.1.
  3. Web site: AROS Research Operating System.
  4. Web site: FreeDOS 1.2 Updates Group - Utilities . Ibiblio.org . 2022-09-08.
  5. http://unixhelp.ed.ac.uk/CGI/man-cgi?which which man page
  6. Web site: Native Win32 ports of some GNU utilities . Unxutils.sourceforge.net . 2022-09-08.
  7. Web site: Get-Command (Microsoft.PowerShell.Core) - PowerShell.
  8. Web site: FreeDOS 1.2 Updates Package - which (Unix-like) . Ibiblio.org . 2002-03-20 . 2022-09-08.
  9. Web site: AROS Research Operating System.