Friday, May 6, 2011

Display the size of file and directory in Linux using DU command

The du command below show the files size in the current directory in MB or K.

[root@linux_1]# du –h

 

Get the total size of current directory

[root@linux_1]# du –s

[root@linux_1]# du –sh

(-s = summarize and -h = human readable format)

 

To get the size of file and directory in current directory

[root@linux_1]# du -sh *

 

Display the size of specific file extension

[root@linux_1]# du -ch *.txt

 

To produce grand total of the directory size

[root@fedora home]# du -csh *

No comments: