next up previous contents
Next: Counting the number of Up: Other useful commands Previous: Disk quota   Contents

Checking disk usage

The command du is handy in determining how much space is used by a directory and its subdirectories. For example:

[amit@onyx C-examples]: du doublyLinkedLists
220     doublyLinkedLists/bad
100     doublyLinkedLists/library
172     doublyLinkedLists/generic
548     doublyLinkedLists
[amit@onyx C-examples]:

By default, du reports sizes in units of Kilobytes (1024 bytes). You can ask for human readable units by using the -h option. For example:

[amit@onyx C-examples]: du -h doublyLinkedLists
220K    doublyLinkedLists/bad
100K    doublyLinkedLists/library
172K    doublyLinkedLists/generic
548K    doublyLinkedLists
[amit@onyx C-examples]:

If you just want the sum total usage of the directory, use the -s option. For example:

[amit@onyx C-examples]: du -h -s doublyLinkedLists
548K    doublyLinkedLists
[amit@onyx C-examples]:



Amit Jain 2013-04-22