Powered By Blogger

Friday 23 November 2012

Directory Size & Drive Size / Used Space

Directory Size

The command to use is situation is du and various useful examples of this command are shown below. The man page, of course, provides full coverage.
du
Entering just du will provide you with a pretty comprehensive output of the size of the current directory and every directory under it in a recursive manner. The displayed size is in kilo bytes and is listed for each directory. Personally, I find this less than useful and I think a better default action would be the command shown below.
 
# du --max-depth=1 -h
 
This version of du will list the total size of each directory under the current directory but only recurse one level deep. It will also display the sizes in a human readable format (e.g. megabytes, gigabytes, etc)
 
# du /foo/bar

Useful when you only want to know about one particular directory.
 
# du -a
 
Prints out the size of every file and directory under the current directory - be prepared for a lot of output.
 
# du -s

Show just a summary for each argument
 
# du -S
 
Don't include the size of sub-directories in the total. This gives you the size of just the files in the current directory.

Drive Size / Used Space

If you want to find out how much space you are using on a drive use:
 
# df -h
 
Anzil Ali Liyakkath 
anzil.ali@webhostrepo.com 

No comments:

Post a Comment