largest_files
This is an old revision of the document!
Largest files in file system
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
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:
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;
largest_files.1430825092.txt.gz · Last modified: 2024/05/23 07:26 (external edit)