find command tricks

Finding Empty Directories:

find ./ -type d -empty -print0 | xargs -0 rmdir

Find and bulk move files:

find ./ -type f -name "*.db" -print | while read line; do (mv $line ./DreamPunsDBData/$line) done;
find ./DreamPunsDB/ -type f -name *Data.db | sort -n > ./DreamPunsDBSST.list

find /tmp -name core -type f -print0 | xargs -0 /bin/rm -f
find /path/to/files -name *.tsv -type f -print0 | xargs -0 -I {} /bin/mv {} /path/to/destination

Find and delete:

find  /media/ephemeral0/data/logs/ -type f -mtime +461 -print0 | xargs -0 /bin/rm -f
find  /media/ephemeral0/data/logs/ -type f -mtime -90 -print0 | xargs -0 /bin/rm -f
find /var/log/hoover/v6 -iname *failed_core* -daystart -mtime +720 -print0 | xargs -0 /bin/rm -f
find / -type f -size +10000000k -exec ls -lh --sort=size {} \; | awk '{ print $9 ": " $5 }'

Using ‘grep’ as a ‘find’ command

grep -R -aiH "iSSD" /var /etc /home

Finding Difference Between Directories:

diff -rq dir_1 dir_2 | sort > dir_1_diff.txt

Sort Files:

sort -t : -k 3,4 -n /etc/passwd | more