Often while I’m administrating a Linux/Unix box I come across the tediousus task of freeing up space on the server, usually this task is easily accomplished by issuing a simple “ls -lh” command, you get a nice listing of the files in the current directly along with some nifty details like last modification date and size (the -h parameter for ls allows us to get the size in a human-readable way).
The downsize of doing it this way is that you don’t get to know for real the size of the folders within the current directy, you get a nice total on top of the “ls” listing. A nice command to get the size of a certain folder is issuing a ds
du -sh folder/
This way you’ll get the following result:
pepper:~ pepper$ du -sh perrohunter.com/
You can see that the folder perrohunter.com weights a total of 694 MB. (yeah, that much).
But what if you’d like to know the size of all the folders within the current folder? Piece of cake, just use the * wildcard and that’d do the trick:
du -sh *
And you should get a result similar to the following:
pepper:~ pepper$ du -sh *
You can see the folders now have the total size of them in MB. Hope this is helpful for you.