Questions tagged [which]

The unix command "which" is commonly used to search for an executable in the PATH, even though it is not very good at this job.

which is a shell command that searches for an executable in the command search path ($PATH — see ) by name. Use this tag for questions about the which utility and about other commands that perform a similar function.

which has many pitfalls. It is usually more reliable to use command -v or type instead.

Further information

91 questions
2
votes
2 answers

Switch between two installs of one program

I have two copies of svn on my machine. /usr/local/bin/svn /opt/subversion/bin When I run which svn it states the first is running how can I switch it to the second?
2
votes
4 answers

Can I use which command on aliases?

Example: I have alias chrome='google-chrome'. I want which chrome to return the same thing which google-chrome returns, i.e.: /usr/bin/google-chrome Is that possible?
syntagma
  • 12,311
1
vote
1 answer

What is the difference between `which ` and `command -v `?

When I put in which npm, I get /usr/local/bin/npm. When I put in command -v npm, I get /usr/bin/npm. Why is that? What's the difference? man which says which "returns the pathnames of the filenames that would be executed in the current environment".…
1
vote
2 answers

how do I get the 'which' command to resolve symlinks?

I've symlinked a script file into my ~/bin, and when I do which foo the output is: /Users/me/bin/foo Is there a way to have this resolve the symlink and show me the real file?
joachim
  • 7,687
0
votes
1 answer

What is which command output ordering?

In bash I see which returns the paths in order, but in zsh it has different ordering. I now primarily use zsh, how can I get proper output ordering of which in zsh? Why is it different? I expected the ordering to match my path. My path is:…
0
votes
1 answer

"which" command difference

What is the difference between (unix-system “which [name]) and which [name] commands. For example when I use the (unix-system “which visual_elite) command I get the following…
user6364