disk space
5 Replies
To see total usage you can use
df -h
To see how much space each directory and it's subdirectories it taking up you need to cd into the dir and then run
du -h
Adam
@mgeorge:
Being relatively new to some aspects of Linux, what is the easiest way to determine what areas of my filesystem are taking up the most space?
I do the following, as root:
du / 2>&1 | tee /tmp/du.out
That command writes an entry for every directory on the filesystem indicating its size (in kilobytes). Then I view the results with:
sort -nr /tmp/du.out | less
This sorts the list so that the "biggest" directories are show first. Note that the size indicates the size of the directory and all of its subdirectories. So a big /usr doesn't necessary mean that much, you have to drill down a little bit to figure out what directories are really using the most space unnecessarily.
du -sh /var/log/
-Chris
du -Sh $dir
The following is some example output (to get an idea of what I'm talking about)
sunny@atticus[~]$ du -Sh /var/log/
80K /var/log/cron
460K /var/log/cups
516K /var/log/daemons
664K /var/log/kernel
68K /var/log/lpr
380K /var/log/mail
68K /var/log/news
8.0K /var/log/samba
5.4M /var/log/security
2.6M /var/log
this helps greatly when needing to locate that specific directory that is eating up your hard disk space
Bill Clinton
du –max-depth=1 (or however much detail you want)