Difference between revisions of "Find"

From DevOps Notebook
(Created page with "== Find largest files in given location == <pre> find /home/tecmint/Downloads/ -type f -exec du -Sh {} + | sort -rh | head -n 5 </pre>")
 
Line 2: Line 2:
 
<pre>
 
<pre>
 
find /home/tecmint/Downloads/ -type f -exec du -Sh {} + | sort -rh | head -n 5
 
find /home/tecmint/Downloads/ -type f -exec du -Sh {} + | sort -rh | head -n 5
 +
</pre>
 +
== Delete files older then X hours ==
 +
<pre>
 +
find <location> -name <file_pattern> -type f -mmin +360 -delete
 
</pre>
 
</pre>

Revision as of 10:03, 27 February 2020

Find largest files in given location

find /home/tecmint/Downloads/ -type f -exec du -Sh {} + | sort -rh | head -n 5

Delete files older then X hours

find <location> -name <file_pattern> -type f -mmin +360 -delete