Find: Difference between revisions
→Time based Sort
(7 intermediate revisions by the same user not shown) | |||
Line 9:
find ~ -name *.txt
Find empty files/folders
find ~ -type d -empty
Line 20 ⟶ 21:
List only the non-hidden empty files only in the current directory
find . -maxdepth 1 -empty -not -name ".*"
Find Files Using Name and Ignoring Case
Line 29:
Find all directories
find
find ~/test ! -name *.jpg ! -name *.gif ! -name *.png ! -name *.jpeg ! -name *.JPG ! -name *.bmp ! -name *.html ! -name *.htm ! -type d▼
Find only the normal files
find . -type f
Find all the hidden files/directories
find
find ~ -type d -name ".*"
▲ find -type d -name ".*"
= Time based Sort =
Line 59 ⟶ 56:
Find files which got accessed within 60 minutes
find / -amin -60
find / -atime -1
Line 183 ⟶ 180:
find -maxdepth 1 -not -iname "MyCProgram.c"
Find files of specific Extensions:
find . -name '*.jpg' -name '*.gif' -name '*.png' -name '*.jpeg' -name '*.JPG' -name '*.bmp' -name '*.html' -name '*.htm'
Find all files except for specific Extensions:
▲ find
Searching all files with 777 permission
find / -type f -perm 0777
Search world readable files - everyone has only read access on that file (444 or -r–r–r– permission); numeric as well as u-g-o (user, group, others) format can be used with -perm switch
find / -type f -perm 444
find / -type f -perm /u=r -perm /g=r -perm /o=r
If you are suspecting some user is spamming files on server, you can search files with his ownership:
find / -type f -user aman
Similarly, files owned by specific group can be searched
find / -type f -group dba
<br />
|