프로그래밍/OS
리눅스 which ,where ,locate
낭만가을
2018. 7. 21. 22:35
which
which는 특정명령어의 위치를 찾아주는 명령어이다.
BASH
which find
/bin/find
검색 가능한 모든 경로에서 해당 명령어를 찾음
BASH
which -a find
/bin/find
/usr/bin/find
where
whereis는 명령어의 실행파일위치, 소스위치, man 페이지파일의 위치를 찾아주는 명령어이다.
BASH
whereis find
find: /bin/find /usr/bin/find /usr/share/man/man1/find.1.gz
locate
locate는 다양한 패턴의 파일들을 찾고자 할 때 매우 유용하게 사용되는 명령어이다.
현재 시스템에 존재하는 *.bak 에 해당하는 파일 찾기
BASH
locate *.bak
특정패턴에 해당하는 파일들 가운데 지정한 개수만큼 검색
BASH
locate -n 10 *.conf