Jump to content

which (command)

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Ghettoblaster (talk | contribs) at 03:45, 27 January 2019 (Ghettoblaster moved page Which (Unix) to Which (command): Computing related articles should cover different implementations of a particular command if it is available on more than one platform/shell. See also: cd (command), alias (command), mkdir etc.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

which
Developer(s)Carlo Wood
Stable release
2.21[1] / March 20, 2015; 9 years ago (2015-03-20)
Operating systemUnix, Unix-like, Microsoft Windows[2]
TypeCommand
LicenseGNU GPL v3
Websitecarlowood.github.io
which
Developer(s)Trane Francks
Stable release
2.1[3] / March 20, 2002; 22 years ago (2002-03-20)
Operating systemFreeDOS
TypeCommand
LicenseGNU GPL v2
WebsiteTrane's World: Reinvented
which
Operating systemAROS Research Operating System
TypeCommand
LicenseAROS PUBLIC LICENSE (APL) Version 1.1 (based on the MPL)[4]
Websitearos.sourceforge.net

In computing, which is a command in Unix and Unix-like operating systems used to identify the location of executables. The command is also available in the AROS shell[5] and for FreeDOS[6] and 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]

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

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

AROS Research Operating System

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

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

  1. ^ https://carlowood.github.io/which/
  2. ^ a b c which for Windows from the GnuWin32 project
  3. ^ http://www2.gol.com/users/trane/Tranes_World__Reinvented/Programming.html
  4. ^ http://aros.sourceforge.net/license.html
  5. ^ http://aros.sourceforge.net/documentation/users/shell/index.php
  6. ^ http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/pkg-html/group-util.html
  7. ^ a b "Command", The Open group base specification, Issue 7, IEEE std 1003.1-2008
  8. ^ which man page
  9. ^ http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/pkg-html/which.html
  10. ^ http://aros.sourceforge.net/documentation/users/shell/which.php