Hi,
I want to retrieve the directory in the shell script that is using maximum space on the disk.I was using du command but it displays all the directories that are using the space on the disk.How can retrieve the only directory which uses the maximum space on the disk??
Thanks in advance.
Regards,
Harika Mamidala
something like this
du -sk * | sort -nr | more
du -sk * | sort -n | tail -1
Hi,
Thanks for ur reply.I am able to get the directory name thats occupying the maximum space using .. ls |du -sk * | sort -n | tail -1 | cut -f2
Is there anyway that I can get the directory that uses more than 80% of the disk space instead of mentioning the directory that uses the maximum space.
Thanks & Regards,
Harika Mamidala
TOT_KB=`df -k . | tail -1 | awk '{ print $2 }'`
du -sk * | awk '{ if ($1 > ('$TOT_KB'*0.8)) print; }' | sort -n