Linux disk usage statistics
The following are some useful commands to figure out which directory is consuming all of your disk space.
You can use the df command to find your disk free space for your mounted filesystems, for example :-
Show Plain TextText code
- # df -h -T
- Filesystem Type Size Used Avail Use% Mounted on
- /dev/sda1 ext3 57G 15G 39G 28% /
- tmpfs tmpfs 1.9G 0 1.9G 0% /lib/init/rw
- udev tmpfs 10M 52K 10M 1% /dev
- tmpfs tmpfs 1.9G 0 1.9G 0% /dev/shm
The du cammand can be used to give your disk usage information, for example :-
Show Plain TextText code
- # ls | du -ch
- 52K ./mysql
- 4.0K ./bittorrent
- 20K ./apt
- 136K ./ntpstats
- 4.0K ./samba/cores/smbd
- 4.0K ./samba/cores/nmbd
- 12K ./samba/cores
- 4.9M ./samba
- 4.0K ./iptraf
- 540K ./apache2
- 12K ./fsck
- 56K ./exim4
- 4.0K ./news
- 9.2M ./installer/cdebconf
- 9.8M ./installer
- 21M .
- 21M total
It is usefull du -k |sort -nr