Unix中的where
和which
命令有什么区别?
答案 0 :(得分:1)
你的意思是哪里?哪个只找到二进制文件,而wehereis也试图找到源文件和手册页。
答案 1 :(得分:1)
“where”似乎不是常见的unix命令,我找不到任何手册页。
然而,"where" does exist in most Windows OSs.
查看上述链接。
WHERE (Windows 2003 + )
Locate and display files in a directory tree.
The WHERE command is roughly equivalent to the UNIX 'which' command.
By default, the search is done in the current directory and in the PATH.
这是有道理的,因为“which”的手册页指出:
WHICH(1)
NAME
which - shows the full path of (shell) commands.
你在使用Cygwin吗?
我问,因为这将是最常见的情况,其中“哪个”和“哪里”将存在于同一环境中。
在那个环境中,“which”将显示命令所在的位置是类似unix的路径。
$ which where
/cygdrive/c/Windows/system32/where
和“where”会以类似方式显示窗口中的路径。
$ where which
C:\cygwin\bin\which.exe
答案 2 :(得分:1)
免责声明:这是在使用cygwin的Windows框中。
Which
显示一个可执行文件Where
的完整路径可以显示多个。
$which git sh
会产生类似/bin/git/
传递的第一个arg的相对路径,但是
$where git sh
为所有传递的参数产生绝对路径,即 注意我在一个Windows框上,所以我得到了一些影响
的东西C:\Program Files (x86)\Git\bin\git.exe
C:\Program Files (x86)\Git\cmd\git.exe
C:\Program Files (x86)\Git\bin\sh.exe
要添加到其他答案,我认为只存在于Windows中。