The Unix and Linux df command
The Linux df command stands for "disk free". It is meant to show Linux disk space information, including disk space that is used, disk space remaining, and how filesystems are mounted on your Linux (or Unix) system. The df command not only shows the free disk space on your local computer, it also shows the free disk space on all networked filesystems that are mounted by your Linux system.
A Linux df command example
Here's the most basic example of Linux df command, with output shown here from a CentOS Linux computer:
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vzfs 10485760 5713424 4772336 55% /
Rather than try to explain that particular output, let me say that I never use the df command that way any more. Instead, I always use the -h option of the Unix df command, like this:
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda11 713G 21G 656G 4% /
The -h option stands for "human readable", so as you can see, my current Linux system has one filesystem, and it is mounted as / (the root filesystem), and it is a 731 filesystem, with 21G.B used, 656GB available, and it is 4% used (which is pretty easy to see with round numbers like this example).
A Mac OS X (Unix) df command example with many filesystems
While my current Linux system has only one filesystem, which is mounted as the root directory (/), my Mac OS X 10.5.x system (which is a Unix-based operating system) has several filesystems, and I can also see its "disk free" information with the Unix df command:
$ df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/disk0s2 93Gi 82Gi 11Gi 89% /
devfs 107Ki 107Ki 0Bi 100% /dev
map -hosts 0Bi 0Bi 0Bi 100% /net
map auto_home 0Bi 0Bi 0Bi 100% /home
As you can see, this Mac has four filesystems that are mounted on /, /dev, /net, and /home. You can also see that the format of this output is a little different than the format from my CentOS Linux system. (And most importantly for me, you can see that my primary 93GB filesystem is 89% full -- yikes.)
More df command information
If you have Linux or Unix df command examples you'd like to share, including output from other systems, feel free to share that output in the comments section below. As usual, you can also look at your Linux/Unix man page on the df command to get more help, like this:
man df
For your convenience, I've now included on online version of the Linux df command man page on this website.
Capture Output information on a specific device or file system node
You may also specify the device or node, for example: df /node_or_dirname Replace /node_or_dirname with the name of your chosen file system node or mounted directory name.
# df -h /DATA01/
Filesystem Size Used Avail Use% Mounted on
/dev/sda11 713G 21G 656G 4% /DATA01
root@uu-dm:~# df -h /DATA01/ | awk '{print $4}'
Avail
656G
with the help of grep we can extract only the size.
root@uu-dm:~# df -h | grep /DATA01 | awk '{print $4}'
656G
No comments:
Post a Comment