Questions tagged [which]
33 questions
220
votes
11 answers
PowerShell equivalent to the Unix `which` command?
Does PowerShell have an equivalent to the which command found in most (if not all) Unix shells?
There are a number of times I'd like to know the location of something I'm running from the command line. In Unix I just do which , and it tells…
Herms
- 9,992
161
votes
6 answers
What's the difference between “which” and “whereis?”
What's the difference between which and whereis?
mk12
- 3,342
155
votes
6 answers
What is Windows' equivalent of the "which" command in Unix? Is there an equivalent PowerShell command?
In Linux, we have the "which" command to find out the path of an executable.
What is its Windows equivalent? Is there any PowerShell command for doing that?
Invincible
32
votes
1 answer
"whereis" and "which" return different paths in Mac OS X
I've got the default OpenSSL 9.8 (Mac OS X 10.6.8) and decided to install the newest version (1.0.1) via MacPorts (sudo port install openssl).
These are console output of which and whereis commands:
$ whereis openssl
/usr/bin/openssl
(this is…
jctim
- 548
27
votes
3 answers
Difference between locate and which in Linux
What is the difference between locate and which in Linux?
Why when I use locate mentor does it list all the mentor but when I used which mentor it says "no mentor in..." - what does this mean?
Naddy
- 271
14
votes
1 answer
'which' equivalent in Windows
Possible Duplicate:
Windows equivalent of whereis?
For Linux/Mac I can use which to locate the file. What would be the equivalent to this command line tool of which?
prosseek
- 6,054
11
votes
2 answers
How can I "which " in cmd.exe
Is there a way to quickly determine where a binary (that the %PATH% variable points to) is located.
That is something that would do the equivalent of which perl in a traditional unix shell.
I understand that The resource Kit has a where command, but…
René Nyffenegger
- 2,444
9
votes
3 answers
does PATH search include symlinks?
The POSIX shell standard says on this site
http://pubs.opengroup.org/onlinepubs/9699919799/
about how shells use PATH to look for executables:
"The list shall be searched from beginning to end, applying the filename to each prefix, until an…
user322908
- 819
8
votes
4 answers
in Windows command line: How to know the path of a command?
I have some program in many places (it is the java command)..
I am starting this command from CMD. the problem is, I need to know exactly the path of the java command being run..
(If you know unix, I need a command such as which ).
Thanks.
Muhammad Hewedy
- 489
7
votes
3 answers
`which python` points to the python I want, but `python` runs the wrong version
I want to use python24 provided by ports, so I've installed it, and python_select -s shows that the version I want is indeed selected. Running which python gives /opt/local/bin/python, and running /opt/local/bin/python gives me the version I want.…
tramdas
- 173
6
votes
2 answers
How to bypass 'noglob' for 'which' in zsh?
I want to use the which command to see which executable is actually being invoked, but the defensive noglob aliases keep getting in the way.
Is there a shortcut that I can use to find which executable is invoked when the command is aliased ?
I am…
Ivar
- 113
6
votes
4 answers
Linux: find first result from specified search path
If I have a colon-separated path list, much like $PATH, but not neccessarily $PATH.
I want to search that list for a specific file name. However, I only want the first matching path.
I have considered the following linux commands:
which: only…
Kevin A. Naudé
- 163
6
votes
3 answers
How do I change the default version of a unix executable?
I currently have two versions of the same executable installed on my OSX machine: one sits in usr/bin, and the other is a Macports installation. When I run which, the terminal returns the location to the usr/bin version. Is there a uniform way to…
rib3ye
- 1,214
5
votes
2 answers
Bash path acting oddly
I am trying to run openscad from the command line and it throws an error, but if I type out the whole path reported by which it seems to work as shown below.
[dataproc@Euclid ~]$ which openscad
/usr/bin/openscad
[dataproc@Euclid ~]$ openscad
bash:…
shawn
4
votes
2 answers
"which" Program Requires Shell Refresh to See Newly Installed Programs?
Why does the Linux program which require you to refresh the shell (e.g. type tcsh in the terminal) to see new programs installed in your path??
I was baffled why I couldn't access a program, which had the same permissions as other programs in…
Jason R. Mick
- 285