Categories: TutorialsUbuntu

Linux df vs Linux du commands compared

The commands df (Disk Free) and du (Disk Usage) are both used to get a snapshot of the disk utilization of the system. The df command provides a less accurate ballpark figure of the available disk utilization while du command is more accurate and tells you the exact figure of a given directory or subdirectory.

But both the df vs Linux du commands are useful to get useful insight on your Linux system. And in this article we will compare Linux df vs Linux du commands, look into their main differences and see some Linux df vs Linux du commands.

What Is The Difference Between Du And Df Command In Linux

Sponsored

We previously mentioned that both Du And Df Command give information about the disk utilization of a Linux system. The main difference between the Du and Df command is how the information is presented to the end user. Du is a standard Unix program used to estimate file space usage (space that is used under a particular directory). While df is a common Unix command used to show how much disk space is available for file systems when the user issuing the command has authorized read access.

Let’s look at their differences in detail to find out when each of the commands should be used.

df command in Linux (with example)

If no file name is given, the Df command gives info on the space available on all currently mounted file systems. The space is given on blocks starting from 1K blocks by default unless the environment variable POSIXLY_CORRECT is set to 512-byte blocks.

However, if a file name is provided, df shows the space available on that file system rather than on the file system containing the device node.

Some examples of df command include:

df

The simplest df command without any command parameters is used to display information about the file system disk space usage. It also shows the device name, total blocks, total disk space, used disk space, free disk space and other useful information.

df -a

Sponsored

Using the df command with -a or –all is used to show dummy file systems information along with all the basic file system disk usage information.

df -h

The disk utilization information are presented in 1K blocks by default which can be a bit challenging to understand. So, to make things a bit user-friendly you can use the “-h” command parameter to show the file system disk space usage data in “human readable” format.

du command in Linux (with example)

Df is another common Unix command which is used to show how much disk space is available for file systems when the user issuing the command has authorized read access. A common Unix tool called du is used to calculate the amount of disk space consumed by a certain directory or set of files on a file system. Each FILE and/or directory’s disk space use is tallied by the du tool. Printing of disk space is done in 1024-byte increments.

Some examples of df command include:

df -k

The most basic command which is used to display all file system information in 1024-byte blocks.

df -m

If you do not want to see the file size in a kilobyte and prefer the more standardized Megabyte, you can use the command argument -m to display the file information in MB (Mega Byte). You can also use the attribute -h to see the info in GB (Gigabyte).

Ubuntu Server Admin

Recent Posts

Cut data center energy costs with bare metal automation

Data centers are popping up everywhere. With the rapid growth of AI, cloud services, streaming…

12 hours ago

Build the future of *craft: announcing Starcraft Bounties!

Our commitment to building a thriving open source community is stronger than ever. We believe…

12 hours ago

NodeJS 18 LTS EOL extended from April 2025 to May 2032 on Ubuntu

The clock was ticking: Node.js 18’s upstream End of Life (EOL) The OpenJS Foundation is…

12 hours ago

Native integration now available for Pure Storage and Canonical LXD

June 25th, 2025 – Canonical, the company behind Ubuntu, and Pure Storage, the IT pioneer…

1 day ago

Revolutionizing Web Page Creation: How Structured Content is Slashing Design and Development Time

Co-authored with Julie Muzina A year ago, during our Madrid Engineering Sprint, we challenged ourselves…

2 days ago

Ubuntu Weekly Newsletter Issue 897

Welcome to the Ubuntu Weekly Newsletter, Issue 897 for the week of June 15 –…

3 days ago