find /home/ -type f -mtime +7 -exec rm '{}' \;
removing files smaller than 5KB
find ./ -size -5k -delete
removing files larger than 10MB
find ./ -size +10m -delete
Blog
Deleting files older than X days
find /home/ -type f -mtime +7 -exec rm '{}' \; delete files smaller than 5KB find ./ -size -5k -delete delete files larger than 10MB find ./ -size +10m -delete

find /home/ -type f -mtime +7 -exec rm '{}' \;
removing files smaller than 5KB
find ./ -size -5k -delete
removing files larger than 10MB
find ./ -size +10m -delete
Note: This post may be AI-assisted and then human-edited. Editorial responsibility: Dmytro Lomaka, Kaltenkirchen.
Essential cookies are always active. Statistics, external fonts and marketing load only with your consent (GDPR).
Language, session, consent storage
Anonymous visit analytics
Google Fonts and other CDNs
Advertising pixels and trackers
Scan to open this site quickly on your phone