In Windows, when I need a list of directories, showing their size, I use Total Commander. In the shell on Linux how do we do this?
Say you need a list of all the home directories and the total size of each.
Do the following:
cd /home
du -sck * | sort +0nr
du is the utility for showing file sizes
-s means summarise - so don't show the subdirectories - just show the total size of each directory
-c means give a grand total
-k means show the numbers as counts of kilobytes, so for example, a 186MB directory, will show up as 186000
* means show everything
We then pipe to the sort utility, which sorts the directory list by size.
Remove r to list in ascending order.
If you want to see the sizes in MB, the command is:
du -sc --block-size=M * | sort +0nr
Finally, if you don't want to see some directories, you can exclude them by name or pattern:
Exclude directory called 'dir1': du -sck --exclude=dir1 * | sort +0nr
Exclude directories with names that start with 'abc': du -sck --exclude=abc* * | sort +0nr
How to get a list of directory sizes in Linux
Receive posts as soon as they are written:
Subscribe in a reader
Posted by randomtech at Saturday, February 14, 2009
Labels: directory size, linux, linux commands, shell
Labels
- google chrome (5)
- microsoft (5)
- google (4)
- google browser (4)
- windows (4)
- wordpress (3)
- .net (2)
- css (2)
- database (2)
- development (2)
- firefox (2)
- gmail (2)
- google docs (2)
- mysql (2)
- rss (2)
- seo tips (2)
- wget (2)
- windows vista (2)
- .net 3.5 (1)
- 404 (1)
- JungleDisk (1)
- access (1)
- addons (1)
- adp (1)
- adsense (1)
- adtoll (1)
- adwords (1)
- amazon (1)
- asp.net (1)
- back links (1)
- backlinks (1)
- bacula (1)
- blogging (1)
- box (1)
- browser exploits (1)
- category rss (1)
- cell phone (1)
- cell phone comparison (1)
- cheap cell phones (1)
- chrome (1)
- chrome.manifest (1)
- cloud (1)
- code (1)
- color chart (1)
- colour chart (1)
- conditional formatting (1)
- copy (1)
- corrupt (1)
- cross-reference (1)
- debian (1)
- delete file windows vista (1)
- directory size (1)
- div (1)
- dotnet (1)
- dreamhost coupon (1)
- dreamhost promo (1)
- dreamhost promo code (1)
- duplicate content (1)
- error (1)
- excel (1)
- exception (1)
- firefox 3 rc1 (1)
- firefox 3.1 (1)
- firewall (1)
- firewall script (1)
- fix (1)
- get all wordpress images (1)
- gmail 2.0 (1)
- gmail error (1)
- google chrome 2.0 (1)
- google chrome dev (1)
- google chrome exploit (1)
- google reader (1)
- google reader tags (1)
- gtdinbox (1)
- hex color (1)
- hex colour (1)
- htaccess (1)
- html (1)
- iis6 (1)
- installation (1)
- internet explorer (1)
- ipod touch (1)
- ipod touch 2g (1)
- ipod touch freeze (1)
- ipod touch magnet case (1)
- ipod touch magnet case problem (1)
- ipod touch problem (1)
- itunes (1)
- javascript (1)
- joomla (1)
- latex (1)
- leeching (1)
- link checker (1)
- linkbacks (1)
- linux (1)
- linux commands (1)
- making money online (1)
- mega cheap phones (1)
- microsoft excel (1)
- microsoft word (1)
- mozy (1)
- ms word (1)
- msdtc (1)
- mssql (1)
- network issue (1)
- network path not found (1)
- network path was not found (1)
- network problem (1)
- networking (1)
- new movies (1)
- nintendo (1)
- nocheckbrowser (1)
- number (1)
- odf (1)
- odt (1)
- online backups (1)
- open source browser (1)
- openoffice (1)
- photoshop (1)
- phpmyadmin (1)
- podcast (1)
- pr checker (1)
- productivity (1)
- recover (1)
- repair (1)
- reset joomla admin password (1)
- rewrite (1)
- seo tools (1)
- sequence (1)
- shell (1)
- spreadsheet (1)
- spreadsheet formula (1)
- sql (1)
- sql server (1)
- sqlclient (1)
- ssis (1)
- ssl (1)
- sun (1)
- trust (1)
- videos (1)
- web dev (1)
- web security (1)
- webdev (1)
- webmail (1)
- webmaster tips (1)
- wii (1)
- windows live toolbar (1)
- windows xp (1)
- winxp (1)
- word tips (1)
- wordpress 2.7 (1)
- wordpress plugin (1)
- wp super cache (1)

0 comments:
Post a Comment