Find: Difference between revisions

updated
No edit summary
(updated)
Line 1:
[[Category:Linux]]
__TOC__
<br />
 
= Time based Sort =
 
Created within 2 days
Line 12 ⟶ 16:
Find empty folders
find ~/test -type d -empty
 
= Delete Files =
 
Delete empty folders
Line 24 ⟶ 30:
 
Search all jpg images in the system and archive it
find ~/test -name *.jpg -type f -print | xargs tar -cvzf images.tar.gz
 
Find Files Using Name
Line 60 ⟶ 66:
 
Finding the Top 5 Big Files
find . -type f -exec ls -s {} \; | sort -n -r | head -5
 
Finding the Top 5 Small Files
find . -type f -exec ls -s {} \; | sort -n | head -5
 
List the smaller files other than the ZERO byte files
find . -not -empty -type f -exec ls -s {} \; | sort -n | head -5
 
Find only the socket files
Line 85 ⟶ 91:
Show files which are modified after the specified file
find -newer ordinary_file
 
= Size based Sort =
 
Find files bigger than the given size
Line 158 ⟶ 166:
 
 
= Exec Commands =
 
 
*Perform Any Operation on Files Found From Find Command
find <CONDITION to Find files> -exec <OPERATION> \;