Fajar Priyanto
2011-Feb-15 09:54 UTC
[CentOS] Most efficient/fastest way to see disk usage
Hi all, I use this command to see disk usage: du -cks * | sort -rn | while read size fname; do for unit in k M G T P E Z Y; do if [ $size -lt 1024 ]; then echo -e "${size}${unit}\t${fname}"; break; fi; size=$((size/1024)); done; done The data itself is around 200GB with lots of subdir and small files. The command takes for about 1 hour to finish. Is there a faster way to see the disk usage of some directories? Secondary objective is: To see which directories have changes (added/remove subdir/files) comparing to the previous data. I'm thinking of using "ls -laR" and "diff". But not sure. Thank you.
From: Fajar Priyanto <fajarpri at arinet.org>> To see which directories have changes (added/remove subdir/files) > comparing to the previous data. I'm thinking of using "ls -laR" and > "diff". But not sure.Maybe something like: find / -exec stat -c "%i %a %u %g %s %Y %Z %n" '{}' \; > before then rerun after and diff...? JD ____________________________________________________________________________________ Don't pick lemons. See all the new 2007 cars at Yahoo! Autos. http://autos.yahoo.com/new_cars.html