2019년 5월 14일 화요일

find - 리눅스 파일 찾기 툴

/var/log 폴더에서 log라는 글자가 들어가고 생성된지 5일이 지난 파일을 삭제하는 명령어
sudo find /var/log -name '*log*' -mtime +5 -exec rm -rf {} \;

대문자 S, 숫자 2개가 있는 모든 파일을 찾음.
find . -regex .*/S[0-9][0-9].*

find regex(정규식)에서 '\d' 작동하지 않음.
find 에서 지원하는 정규식에 대한 설명.
https://www.gnu.org/software/findutils/manual/html_mono/find.html#Regular-Expressions

참고 사이트
https://kiros33.blogspot.com/2015/05/find-update20150210.html
https://keichee.tistory.com/166

댓글 없음:

댓글 쓰기

우분투 NFS 설정

* 서버 설정 apt-get install nfs-common nfs-kernel-server rpcbind /etc/exports /home/xyz 192.168.0.X(rw,sync,no_root_squash,no_subtree_check)...