Linux
Delete file older than 30 days
find /path/to/files/ -type f -name '*.jpg' -mtime +30 -exec rm {} \
Order directory by number of files
find . -xdev -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n
Order directory and files by size recursively
du -ah ./ | grep -v "/$" | sort -rh
Lsof sort open file by size
lsof -s | awk '$5 == "REG"' | sort -n -r -k 7,7 | head -n 50
List all user’s crontab in bash
for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done
List directory by inodes usage
find / -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n
Last updated
Was this helpful?