Linux DF Command Examples

Ever wondered how much space you have left on your hard drive? Cannot remember what file format your partitions are? You can use the Linux df command to get some of this data.

This article will give you the heads up on df.

1. Display Disk Usage Using df

erik@debian:~$ df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1              7850996   4116300   3335884  56% /
tmpfs                   258484         0    258484   0% /lib/init/rw
udev                     10240        52     10188   1% /dev
tmpfs                   258484         0    258484   0% /dev/shm

The example above shows the basic output of the df command. However, the output isn’t very readable.

2. Readable Disk Usage Using df -h

The df -h command will display the partition size in human readable form, G for gigabytes, M for megabytes, K for kilobytes.

erik@debian:~$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             7.5G  4.0G  3.2G  56% /
tmpfs                 253M     0  253M   0% /lib/init/rw
udev                   10M   52K   10M   1% /dev
tmpfs                 253M     0  253M   0% /dev/shm

3. Display Partition Types Using df -Th

To display the partition type you can execute the command df -T (with the h for a more user friendly file size).

erik@debian:~$ df -Th
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda1     ext3    7.5G  4.0G  3.2G  56% /
tmpfs        tmpfs    253M     0  253M   0% /lib/init/rw
udev         tmpfs     10M   52K   10M   1% /dev
tmpfs        tmpfs    253M     0  253M   0% /dev/shm

4. Display Dummy File Systems Using df -ah

erik@debian:~$ df -ah
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             7.5G  4.0G  3.2G  56% /
tmpfs                 253M     0  253M   0% /lib/init/rw
proc                     0     0     0   -  /proc
sysfs                    0     0     0   -  /sys
procbususb               0     0     0   -  /proc/bus/usb
udev                   10M   52K   10M   1% /dev
tmpfs                 253M     0  253M   0% /dev/shm
devpts                   0     0     0   -  /dev/pts
none                  0.0K  0.0K  0.0K   -  /proc/fs/vmblock/mountPoint

The Linux operating systems uses various virtual file systems shown here, including /proc /sys /dev. These will displayed when using the df -h command.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *