Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

What is the difference of df and du command?

user-image
Question added by Muhammad Anzar , DevOps/DevSecOps Architect , Confidential
Date Posted: 2013/09/28
Muhammad Tahir Masood
by Muhammad Tahir Masood , IT Project Manager (Infrastructure Support and IS Security) , Solution Founder Technology Company

 

The ‘df‘ command stand for “disk filesystem“, it is used to get full summary of available and used disk space usage of file system on Linux system.

 

The du (disk usage) command reports the sizes of directory trees inclusive of all of their contents and the sizes of individual files

 

Anil Mathew Kadakethu
by Anil Mathew Kadakethu , Technical Support Manager , M H Alshaya

df -h shows you the details of the used / available space in each mounted partition.

du -a shows you the size of the files in the directory which the command was executed.

 

Mohand ourabah BENABBAS
by Mohand ourabah BENABBAS , Systems engineer , dimensiondata

 #df means diks free and  #du disk usage (this is not the size allocated by the system for the file system)  

Arunprakash kanagasabapathi
by Arunprakash kanagasabapathi , Senior System Engineer , ITQAN

du disk usage. It walks through directory tree and counts the sum size of all files therein. It may not output exact information due to the possibility of unreadable files, hardlinks in directory tree, etc. It will show information about the specific directory requested. Think, "How much disk space is being used by these files?"

df is disk free. Looks at disk used blocks directly in filesystem metadata. Because of this it returns much faster that du but can only show info about the entire disk/partition. Think, "How much free disk space do I have?"

DF: Report how much free disk space is available for each mount you have.DU: used to estimate file space usage—space used under a particular directory or files on a file system.

Khandakar Ashfaqur Rahman
by Khandakar Ashfaqur Rahman , Head Of Network , Smart Network Ltd

Simply df  will show you disk free and du will show you disk usage

 

$ df   -k

Filesystem1024-blocks        Free                 %Used     Iused  %Iused       Mounted on

/dev/hd4      32768                  16016                  52%        2271      14%                 /

/dev/hd2      4587520              1889420              59%        37791      4%               /usr

/dev/hd9var65536                  12032                  82%        518          4%               /var

/dev/hd3      819200                  637832              23%        1829        1%               /tmp

/dev/hd1      524288                  395848              25%        421          1%              /home

/proc               - - - - -                                                                                                       /proc

/dev/hd10opt65536                  26004                61%      654          4%                /opt

 

 

$ du -sk *

152304 directoryOne

1856548 directoryTwo

Rana Adnan Akram
by Rana Adnan Akram , Security Specialist , Punjab Information Technology Board

df displays the free disk statistics while the du switch shows the different output like disk usage statistics

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.