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/
694M 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 *
628K application
8.0K cache
40K codeigniter
3.6M database
156K fonts
180K helpers
4.0K index.html
68K language
536K libraries
8.0K logs
36K plugins
76K scaffolding
You can see the folders now have the total size of them in MB. Hope this is helpful for you.
VN:F [1.9.22_1171]