---

17 Linux df command examples to understand it

The Command df ???disk file system??? is one of the very powerful tools every system admin should know. when mastering this command you should understand lot of information about your local and remote file system details like mount point, disk utilization, partitions etc. In this post, we will find out some of the very common and useful ways to use ???df??? to monitor your file system. The df command read its output from /proc/mounts file and a kernel function statfs(2). This file /proc/mounts give you where block files are mounted and statfs(2) will help you query kernel to get present disk sizes. The df command will combine these two and print some meaningful information for a Linux user.

Syntax of df command in Linux

df [OPTION]… [FILE]…
I am firm believer of learning stuff with examples. Below are some examples you should know.

Usage of the df command in Linux

Example 1: Using the ???df??? without any options. If you use the df command without any arguments, it will show you something like below. You will get columns of File system, number of blocks in 1K each, number of used blocks, number of available blocks, used percentage and finally the mount point for each file system. As you will get to know this command better, you will come to know that it is handier to mix it with some options, we will get to that later. You should know about what is block size in Linux before proceeding.
root@linuxnix:/proc# df
Filesystem 1K-blocks Used Available Use% Mounted on
udev 3961912 4 3961908 1% /dev
tmpfs 794540 1372 793168 1% /run
/dev/sdb1 22951396 14653116 7109368 68% /
none 4 0 4 0% /sys/fs/cgroup
none 5120 0 5120 0% /run/lock
none 3972696 385424 3587272 10% /run/shm
none 102400 64 102336 1% /run/user
/dev/sda1 99800 3440 96361 4% /boot/efi
/dev/sda4 849698404 239254192 567258908 30% /opt
/dev/sda2 95990540 73446284 17645084 81% /home
/dev/mmcblk0p1 3871744 1880480 1991264 49% /media/surendra/9016-4EF8
Before going in to examples, we will try to decode some of the above lines.
Example 2: Understanding normal mount mappings

/dev/sdb1 22G 14G 6.8G 68% /
/dev/sdb1 partition is mounted on / whose size is 22G, used is 14Gb and available is 6.8Gb.

Example 3: Understanding special mount mappings.

udev 3.8G 4.0K 3.8G 1% /dev
Some times, We have to mount some folders in special partitions which are virtual in nature. This will help in preventing accidental deletion of important data for system to work properly. The above example /dev folder which contain device file information and may vary with every reboot is actually mounted with a virtual file system.

Example 4: Understanding below line
tmpfs 794540 1372 793168 1% /run
The /run folder is recent implementation which contain process related information and which should not be deleted by any one until next reboot.

Example 5: If you observe below line, the virtual partition is none and mounted on /run/user. In other words this is tactfully virtual file system with the virtual file system, because /run is using tmpfs virtual partition.

none 102400 64 102336 1% /run/user
Understanding remote mounts in Linux df command output
Read Full Post: http://www.linuxnix.com/find-disk-size-details-in-linuxunix/