Skip to content

df command on Linux (disk free)

The df command in Linux (disk free) shows the capacity used of a file system in terms of space and inodes.

An inode is a data structure that describes a file system object, which can be one of several things, including a file or directory. Each inode stores the attributes and the disk block location (s) of the object data. File system object attributes may include metadata (times of last change, access, and modification), as well as owner and permission data (e.g., group id, user id, permissions).

Since the number of inodes is directly linked to the number of files a device can store, it is possible that it will run out and we still have available disk space. This is rare, but it can happen when we have a huge number of small files. The number of inodes is defined in the formation of the disc.

It can take as a parameter the file system for which information is desired. If no file name is provided, df shows the space available on all currently mounted file systems. Disk space is shown in 1K blocks by default.

In this example the df shows the capacity of the disk mounted as root/:

$ df/<br></br>Sist. Ark. Used 1K-blocks Available Use% Mounted on

/dev/mapper/cl-root 42954248 8079412 34874836 19%/

The df -i option shows the number of inodes available:

$ df -i/<br></br>Sist. Ark. Inodes Used iLiVR Usage% Mounted on

/dev/mapper/cl-root 21487616 174290 213326 1%/

Reading the occupied and available space can be done more easily with the -h option:

$ df -h/<br></br>Sist. Ark. Tam. Used Disp. Use% Mounted on

/dev/mapper/cl-root 41G 7.8G 34G 19%/

Without providing the file, the df shows information for all mounted disks:

$ df
-h System. Ark. Tam. Used Disp. Use% Mounted on
devtmpfs 979M 0 979M 0% /dev
tmpfs 996M 0 996M 0% /dev/shm
tmpfs 996M 420K 996M 1% /run
tmpfs 996M 0 996M 0% /sys/fs/cgroup
/dev/xvda1 8.0G 4.7G 3.4G 58%/
/dev/xvdf 20G 12G 7.4G 61% /home
tmpfs 200M 0 200M 0% /run/user/1000