Operating Systems/Linux

[ Linux ] FIND 활용

loopinger 2021. 10. 25. 19:12
# 지정한 패턴의 파일을 검색하여주는 명령어
# find [검색경로] [패턴] 형태로 사용

# etc 폴더에서 확장자 명이 conf인 파일 검색
find /etc -name "*.conf"

# home 폴더에서 소유자(user)가 centos인 파일을 검색
find /home -maxdepth 1 -user centos

# 현재 폴더에서 허가권(permission)이 644인 파일 검색
find . -perm 644

# usr 폴더에서 파일크기가 10kbyte ~ 100kbyte 미만인 파일 검색
find /usr -size +10k -size -100k

# 파일명에 공백이 들어간 파일 검색
find / -name "* *"

# 최근 1시간 내 변경된 디렉토리를 모두 검색
# atime, amin : access time  (접근 시간)
# ctime, cmin : created time (생성 시간)
# mtime, mmin : modification time (수정 시간)
find / -mtime -1 -type d