Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Bash

Find duplicate files

fdupes -r dir123/

Find and delete empty files

find . -type f -empty -print -delete

Find and delete old files

/usr/bin/find /var/backups/* -mtime +100 -name starts-with-* -type f -prune -exec rm -rf {} \;

Find oldest directory (-d) or file (-f)

find /home/aike -type f -printf '%T+ %p\n' | sort | head -n 1

Find newest file (-d) or file (-f)

find /home/aike -type f -printf "%T@ %p\n" | sort -n -r | head -n 1

Find by date

find . -name "*.yaml" -newermt "2023-09-22" ! -newermt "2023-09-23"

FIND INODE USAGE

find / -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n