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
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
3- Total disk size of a directory
$ du -s /home
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
2- Information in human readable format
$ df -h
Above command displays information in human readable format.
3- Display information of a particular partition
$ df -hT /etc
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: [paypal-donation]
Linux TechLab is thankful for your continued support.
a very interesting option of du is max-depth
When someone writes an post he/she retains the thought
of a user in his/her brain that how a user can know it.
So that’s why this paragraph is amazing. Thanks!