largest_files
This is an old revision of the document!
Largest files in file system
Quickly check the log file size:
1 |
du -sh /var/log |
1 |
du -sh /home/rack |
1 2 3 4 5 |
FS= '/' ;NUMRESULTS=20;resize; clear ; date ; df -h $FS; echo "Largest Directories:" ;\ du -x $FS 2> /dev/null | sort -rnk1| head -n $NUMRESULTS| awk '{ printf "%d MB %s\n" ,\ $1 /1024 ,$2}'; echo "Largest Files:" ; nice -n 19 find $FS - mount - type f - ls \ 2> /dev/null | sort -rnk7| head -n $NUMRESULTS| awk '{ printf "%d MB\t%s\n" ,\ ($7 /1024 ) /1024 ,$NF}' |
Excluding a specific directory:
Following shows the largest directories excluding /var/lib/mysql
1 2 3 |
FS= '/' ;NUMRESULTS=20;resize; clear ; date ; df -h $FS; echo "Largest Directories:" ;\ du --exclude /var/lib/mysql -x $FS 2> /dev/null | sort -rnk1| head -n $NUMRESULTS| awk '{ printf "%d MB %s\n" ,\ $1 /1024 ,$2}' |
Other Command:
1 |
echo -e "\n\nHi, \n\nDiskoverview for $(hostname)\n\n $(df -h) \n\nHere is the list of the largest files: \n" ; find / - type f -not -path "/proc/*" -not -path "/dev/*" -not -path "/sys/*" -size +512000k - exec du -hs {} \; ; echo -e "\n\nAnd here is the list of the largest folders:\n" ; du -h / | grep ^[1-9][0-9][0-9.]*G | sort -rn; |
INODES
1 |
nice -n 19 find / - type d 2> /dev/null -print0 | while IFS= read -rd '' i; do echo $( ls -a "$i" | wc -l) "$i" ; done | sort -n -r | head |
largest_files.1453979029.txt.gz · Last modified: 2024/05/23 07:26 (external edit)