du command is very simple and useful for Summarize and estimate files, directories space usage on Linux or Unix system. Can get different types of disk usage information. Also show usage of each FILE, recursively for directories. 

1. du command:

The below command shows number of disk blocks in the /home/linuxfaq directory including sub-directories.


28      /home/linuxfaq/myfile/package/solaris/pkg
40      /home/linuxfaq/myfile/package/solaris
44      /home/linuxfaq/myfile/package
1340    /home/linuxfaq/myfile
44864   /home/linuxfaq/

2. Option: -a --all

'-a' count and displays all the files along with  the directories in the output.
 du -a /home/linuxfaq

4       /home/linuxfaq/myfile/init-script.suse.in
4       /home/linuxfaq/myfile/init-script.suse
4       /home/linuxfaq/myfile/init-script.debian.in
1340    /home/linuxfaq/myfile
4       /home/linuxfaq/.bash_profile
44864   /home/linuxfaq/

3. Option:  -h or --human-readable

Estimate files sizes and displays output human readable format for example K (Kilobit), M (Megabit), G (Gigabit).
 du -h /home/linuxfaq

392K    /home/linuxfaq/myfile/src
28K     /home/linuxfaq/myfile/package/solaris/pkg
40K     /home/linuxfaq/myfile/package/solaris
44K     /home/linuxfaq/myfile/package
1.4M    /home/linuxfaq/myfile
44M      /home/linuxfaq/

4. Option: -ah :

'-a' shows the filenames along with  the directories and '-h' Human readbale
 du -ah /home/linuxfaq/

4.0K    /home/linuxfaq/myfile/init-script.suse
4.0K    /home/linuxfaq/myfile/init-script.debian.in
1.4M    /home/linuxfaq/myfile
4.0K    /home/linuxfaq/.bash_profile
44M     /home/linuxfaq/

5. Option: -k 

-k option displaying information disk usage of a directory tree including subtrees Kilobyte blocks.
du -k   /home/linuxfaq/

392    /home/linuxfaq/myfile/src
28     /home/linuxfaq/myfile/package/solaris/pkg
40     /home/linuxfaq/myfile/package/solaris
44     /home/linuxfaq/myfile/package
1340   /home/linuxfaq/myfile
44864  /home/linuxfaq/

6. option: -kh

-k kilobyes blocks, -h Human readable format,
 du -kh /home/linuxfaq

28K    /home/linuxfaq/myfile/package/solaris/pkg
40K    /home/linuxfaq/myfile/package/solaris
44K    /home/linuxfaq/myfile/package
1.4M   /home/linuxfaq/myfile
44M    /home/linuxfaq/

7. Option: -m

Option -m stands for flag counts the blocks in MB units. -h Specify human readable.
du -m /home/linuxfaq

du -mh /home/linuxfaq

28K    /home/linuxfaq/myfile/package/solaris/pkg
40K    /home/linuxfaq/myfile/package/solaris
44K    /home/linuxfaq/myfile/package
1.4M   /home/linuxfaq/myfile
44M    /home/linuxfaq/

8. Option: -c  --total
 Option '-c' specify that grand total usage disk space at end of output. For example you can see below line,
 du -ch /home/linuxfaq

44M    /home/linuxfaq/
44M    total

9. Option: -s or --summarize

 Use -s option summarize and display only a total space usage for each argument,
 du -s /home/linuxfaq/
44864   /home/linuxfaq/
 du -sh /home/linuxfaq
44M    /home/linuxfaq/

10. Oprion: -sch

We can easily summarize few directory usage with human readable. For example estimate directory usage under '/'
 cd /

du -sch *

9.7M   bin
62M    boot
4.0K   cdrom
4.0K   dev
16M    etc
1.4G   home

11. option: --exclude

use --exclude option,  exclude files that match pattern. The first command displays all files exclude .css extesion and seconds both .css and .cfg extension.
  du -ah --exclude="*.css"  /home/linuxfaq

 du -ah --exclude="*.css" --exclude="*.cfg" /home/linuxfaq/

4.0K   /home/linuxfaq/myfile/init-script.suse.in
4.0K   /home/linuxfaq/myfile/init-script.suse
4.0K   /home/linuxfaq/myfile/init-script.debian.in
1.4M   /home/linuxfaq/myfile
4.0K   /home/linuxfaq/.bash_profile
44M    /home/linuxfaq/

12. Option: --time
 du -ah --time /home/linuxfaq

4.0K   2015-04-22 12:12    /home/linuxfaq/myfile/init-script.suse
4.0K   2013-09-06 20:57    /home/linuxfaq/myfile/init-script.debian.in
1.4M   2015-04-22 12:26    /home/linuxfaq/myfile
4.0K   2014-09-26 07:23    /home/linuxfaq/.bash_profile
44M    2015-05-02 14:26    /home/linuxfaq/ 

Displays all files with time of the last usage or modification in the directory, or any of its subdirectories

13. Option: --max-depth=1

The "--max-depth=1" Shows report for one level deep The space for all folders below that level are still counted,
 du --max-depth=1 /home/linuxfaq/

4912    /home/linuxfaq/ubuntu
38580   /home/linuxfaq/scripts
1340    /home/linuxfaq/myfile
44864   /home/linuxfaq/