Sunday, March 8, 2015

directory space use

Disk Usage
# more disk-opt.ksh
#!/bin/ksh
sudo du -h /opt | grep G | sed 's/^[ \t]*//' > /tmp/tmp1.$$
while read line
do
  space=$(echo $line | awk '{print $1}')
  dir=$(echo $line | awk '{print $2}')
  usr=$(ls -ld $dir | awk '{print $3}')
  echo "$usr $dir $space" >> /tmp/tmp2.$$
done < /tmp/tmp1.$$
cat /tmp/tmp2.$$|sort -k 1
rm -f /tmp/tmp1.$$ /tmp/tmp2.$$
#

No comments:

Post a Comment