その先にあるもの…

find 본문

Linux_Raspberry

find

specialJ 2021. 11. 18. 12:39

find ./ -maxdepth 1 -mtime +0 -name "play*" | grep -i "play[[:digit:]]\+-" | xargs -i mv {} log/

해석

하위 폴더 1단계, 파일 수정이 24시간,  play* 파이들, play숫자 파일들, 삭제

 

 

atime (access time, 접근 시간)
atime은 파일에 접근한 시간을 나타낸다.
파일을 open 할 때마다 갱신이 되며 vi, cat 명령으로 파일 확인시 atime의 값이 변한다.
ls -lu

mtime (modification time, 수정 시간)
파일의 내용이 수정될 때 mtime 시간이 변한다.
ls -l

ctime (change time, 변경 시간)
inode의 값 (파일 속성, 권한, 크기 등)이 변경되면 ctime이 갱신된다.
ls -lc

stat 명령어로 파일 상태 정보 출력



find 에서 타임스탬프로 파일 검색
find -mtime n (일수)에서 'n일 = n*24시간' 이다 달력상의 일수가 아니다. 

find -mtime -2 : 2일(48시간) 이내에 수정된 파일
find -mtime 2 : 3일(72시간) 에서 2일(48시간) 사이에 수정된 파일
find -mtime +2 : 3일(72시간) 보다 과거인 보다 이후에 수정된 파일

 

https://blog.naver.com/PostView.nhn?blogId=sonmit002&logNo=221387990413&parentCategoryNo=&categoryNo=57&viewDate=&isShowPopularPosts=true&from=search

'Linux_Raspberry' 카테고리의 다른 글

tar 제외하기  (0) 2023.01.10
우분투에서 rs232 serial로 pi접속  (0) 2022.10.18
svn 저장소 주소 변경  (0) 2021.05.25
컴에 접속한 유저 확인  (0) 2021.03.30
sh if문 옵션  (0) 2021.03.17
Comments