我在我的Mac上安裝了git
和maven
。我知道它的工作原理。但我很好奇看到這些命令被發現在哪裏git和mvn命令在mac/Linux中運行?
通常的命令,如mv,ls,cd
可在/bin
找到。我沒有找到git
,maven
, grep
在/bin
。我沒有.bashrc nor .bash_profile
。我也沒有在env
看到他們。
我可以看到他們嗎?
我在我的Mac上安裝了git
和maven
。我知道它的工作原理。但我很好奇看到這些命令被發現在哪裏git和mvn命令在mac/Linux中運行?
通常的命令,如mv,ls,cd
可在/bin
找到。我沒有找到git
,maven
, grep
在/bin
。我沒有.bashrc nor .bash_profile
。我也沒有在env
看到他們。
我可以看到他們嗎?
從我的Ubuntu:
$ which git
/usr/bin/git
$ which mvn
/usr/bin/mvn
$ which grep
/bin/grep
which
應該在Mac OS X
whereis
工作也是一個不錯的選擇。從我的Ubuntu:
$ whereis git
git: /usr/bin/git /usr/share/man/man1/git.1.gz
$ whereis mvn
mvn: /usr/bin/mvn /usr/share/man/man1/mvn.1.gz
$ whereis grep
grep: /bin/grep /usr/share/man/man1/grep.1.gz
的POSIX命令'type'應包括在內,甚至是更好的選擇。 – tripleee
對。但是'type'會給別名的命令提供一些其他的信息。在我的ubuntu上,''grep''表示'grep別名爲'grep --color = auto'',而'which grep'則提供所需的信息。這與OP提出的問題嚴格一致。另一方面,我已經很長時間地''TYPE'ing' :) – slayedbylucifer
除了POSIX指定的行爲之外''bash'還提供了'type'的幾個選項,允許它更像'which'的功能。 – chepner
嘗試'這git','這maven',... – devnull