배운 것

[linux command ] which, whereis

썬,더 호글 2016. 3. 4. 22:20

명령어의 위치를 알고 싶다면 which를 사용할 수 있다. 

단점은 path에서 처음 발견된 which에 관한 위치만 나온다는 점이다. 

이를 보완하고 싶을 경우 -a 옵션을 주면 해당하는 모든 위치가 나온다. 


~/test/shPractice which grep

grep: aliased to grep  --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn}

~/test/shPractice which -a grep

grep: aliased to grep  --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn}

/usr/bin/grep


 whereis는  명령어의 실행파일위치, 소스위치, man 페이지파일의 위치를 찾아주는 명령어라고 한다. (출처: http://webdir.tistory.com/158)