Finding Disk Usage from Command Line

Well, it's great to know that Linux has a command for literally everything.

I have a home server right now which handles file storage, backups, etc and I wanted to know how much disk space was left on each drive. The problem was I needed to be able to do this from the command line.

After much searching on Google I finally found a forum that had my answer. This commmand will list the disk usage of each partitioned drive in your system.

df -h

Simply type that into your terminal and it will display something like this:

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              30G  9.0G   19G  32% /
tmpfs                 1.5G     0  1.5G   0% /lib/init/rw
varrun                1.5G  244K  1.5G   1% /var/run
varlock               1.5G     0  1.5G   0% /var/lock
udev                  1.5G  2.8M  1.5G   1% /dev
tmpfs                 1.5G  188K  1.5G   1% /dev/shm
lrm                   1.5G  2.0M  1.5G   1% /lib/modules/2.6.27-11-generic/volatile
/dev/sda6             261G  120G  128G  49% /home
/dev/mmcblk0p1         16G  240M   16G   2% /media/EVERIO_SD
192.168.0.193:/media/disk1
                      294G  278G  907M 100% /media/disk1
192.168.0.193:/media/disk2
                       92G   16G   73G  18% /media/disk2

As you can see it shows my internal hard drive (/dev/sda#) and also the nfs drives that I have connected on the system (very bottom).

A very useful command when trying to run a headless server at home.

Add to Technorati Favorites