Categories: Disks and Partitions

df command on Linux (disk free) [Basic Guide]

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/
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/
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/
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

Uirá Endy Ribeiro

Uirá Endy Ribeiro is a Software Developer and Cloud Computing Architect with a 23-year career. He has master's degrees in computer science and fifteen IT certifications and is the author of 11 books recognized in the IT world market. He is also Director at Universidade Salgado de Oliveira and Director of the Linux Professional Institute - LPI Director's Board.

Uirá Endy Ribeiro

Uirá Endy Ribeiro is a Software Developer and Cloud Computing Architect with a 23-year career. He has master's degrees in computer science and fifteen IT certifications and is the author of 11 books recognized in the IT world market. He is also Director at Universidade Salgado de Oliveira and Director of the Linux Professional Institute - LPI Director's Board.

Recent Posts

Sudo command on Linux (privilege scale) [Basic Guide]

The sudo command on Linux executes a given command as if it were another user.…

2 years ago

SS command on Linux (investigate the network) [Basic Guide]

The ss command on Linux is extremely useful for investigating sockets, providing various information about…

2 years ago

Free Linux command (memory usage) [Basic Guide]

Free Linux command shows the amount of total memory in use and available, as well…

2 years ago

Linux while command (loop – while) [Basic Guide]

The shell has structures for testing conditions and executing certain program sequences several times (loop),…

2 years ago

Linux fstab file (disk mount setup) [Basic Guide]

The /etc/fstab file stores the configuration of which devices should be mounted and what is…

2 years ago

Netcat command on Linux (Swiss network knife) [Basic Guide]

The Netcat Command in Linux or nc is a utility used to do “almost anything”…

2 years ago

This website uses cookies.