Use of du & df commands (with examples)

Last updated on March 12th, 2018 at 07:35 pm

In this article I will discuss du & df commands. Both du & df commands are important utilities of Linux system & shows disk usage of Linux filesystem. Here we will share usage of both commands with some examples.

(Recommended Read: Files transfer using scp & rsync commands)

(Also Read: Cloning Disks using dd & cat commands for Linux systems)

du COMMAND

du command (short for disk usage) is useful command which is used to find disk usage for files & directories. du command when used with various options provides results in many formats.

Some of the examples are mentioned below:-

1- To find out summary of disk usage for a directory with all its sub-directories

$ du /home

du command

Output of the command shows all the files & directories in /home with block size.

 

2- Disk usage with file/directory sizes in human readable format I.e. in kb, mb etc

$ du -h /home

du command

 

3- Total disk size of a directory

$ du -s /home

du command

It will total size of /home directory.

 

df COMMAND

df command (short for disk filesystem) is used to show disk utilization for a Linux system.

Some examples are shared below.

1- To display information of device name, total blocks, total disk space, used disk space, available disk space and mount points on a file system.

$ df

df command

 

2- Information in human readable format

$ df -h

df command

Above command displays information in human readable format.

 

3- Display information of a particular partition

$ df -hT /etc

df command

Using -hT with a target directory will show information of /etc/ in human readable format.

Though there are many more options that can be used with du & df commands, but these should get you started. If you don’t find what you are looking for here then you can always refer to man pages for the concerned command.

Also, read my other posts HERE where i have shared some other important & frequently used Linux.

 

And as always your comments/queries are really appreciated, so please leave your comments/queries down below & I will get back to you.

 

If you think we have helped you or just want to support us, please consider these :-

Connect to us: Facebook | Twitter | Google Plus

Donate us some of you hard earned money:

Linux TechLab is thankful for your continued support.

Shusain

Passionate about Linux & open source. Loves to learn, read & write about Linux as well as new technologies.

You may also like...

2 Responses

  1. mmiat says:

    a very interesting option of du is max-depth

Leave a Reply