Disk Usage: du



next up previous contents index
Next: File Compression Up: Managing Disk Space Previous: Disk Free: df

Disk Usage: du

 

The du command reports the ``disk usage.'' Use it to show the total size of all files in the named directory and for all directories below it. That is, you use df to see if you have a problem and then du to see who is causing it:   

$ ls   	List files and directories.   
bin      docs     lib      runs     samples  src   	   
$ du src   	Show the usage of directory src.   
432     src/kp   	The directory kp uses 432 disk blocks.   
444     src/kabs   	444 in kabs.   
356     src/dslac   	   
392     src/apftn64   	  
264     src/vkabs/test   	   
116     src/vkabs/IBM   	   
1124    src/vkabs   	This is the usage for  vkabs including the subdirectories test and IBM.   
116     src/detmat   	  
752     src/bs   	   
3620    src   	This is the usage for all files and directories under src.   

As we see, the size of each directory under src is listed by default. These listings can get to be quite long at times, in which case the -s option is handy to get a summary:

$ du -s src runs bin lib docs   	Give me a summary of usage.   
3620    src   	   
19420   runs   	   
160     bin   	   
404     lib   	   
24      docs   	   
% du | sort -rn   	Give me an ordered list of usage.   
% du -s * | sort -rn   	Give an ordered list of summed usage.   



next up previous contents index
Next: File Compression Up: Managing Disk Space Previous: Disk Free: df