linux find

linux find

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2020 Jan 3 2:15
Editor
Edited
Edited
2022 Nov 30 18:41
Refs
Refs
fd
fzf

default is recursive

find / name
 

file type

find . -type f # 일반 파일 검색 find . -type d # 디렉토리 검색 find . -type l # 심볼릭 링크 검색
 

file matching

find . -path "*some_path*" find . -path "*some_path/some_file*"
 
 

size matching

find . -size +300k # 크기가 300k 이상인 파일 검색
 
 

file ctime mtime

find . -ctime +1 # 하루 이전에 생성(수정)된 파일 검색 find . -ctime -1 # 하루 이내에 생성(수정)된 파일 검색 find . -newer a # a보다 늦게 생성된 파일들 find . ! -newer a # a보다 일찍 find . -mtime +30 | xargs mv -i {} {}.bak
 
 

boolean control

find . -name "*some_name*" -a -type f -a ! -newer a # and 조건 find . -name "*some_name*" -type f ! -newer a # 이것도 and 조건 find . -name "*some_name*" -o -type f -o ! -newer a # or 조건
 
 
 

Recommendations