Find out how much space each file is occupying

Sathya | March 19th, 2008 - 4:21 pm


Consider this situation. You want to know much space is available on your hard disk. No big deal, du can tell you the stats. For this open the terminal and type du -h. You will get the required details as below

sathya@shaman:~$ du -h /home/sathya/Downloads
35M     /home/sathya/Downloads/kubuntu debs
177M    /home/sathya/Downloads
sathya@shaman:~$ du -h /home/sathya/Downloads/kubuntu\ debs/
35M     /home/sathya/Downloads/kubuntu debs

But this isn’t sufficient, and neither is it very elegant. You want to know how much space each file is occupying, or what’s the max filesize occupied by a file. And you want to achieve this with out any console commands. Sounds tough?

Not really! Konqueror comes with an inbuilt “File Size View” which allows you to do just that. And the neat thing is that this works for all mounted partitons. To open this view, open Konqueror. Right click, choose Preview in and select “File Size View”

File Size View

Once this is selected, another view comes up, showing the size of each file. It may take a minute or two as the filesystem is scanned and the files begin to show up. In the end you’ll get a view like:

File Size View, After Scanning is Complete

This is really useful if you want to free up some space on your hard disk, or if you don’t know which file is taking up all that space.

PS: I don’t know of a similar utility for GNOME, as I don’t use it. Would appreciate it if any GNOME users can comment on a similar app.

PPS: If you’re using KDE 4.x , then as of now, Dolphin doesn’t have the File Size view, so you can’t check this. There’s another program, KDirStat, which can perform the same utility, but I haven’t tested this. Any comment on this would be much appreciated as well!

If you enjoyed this post, make sure you subscribe to my RSS feed!

9 Responses to “Find out how much space each file is occupying”

  1. Santosh says:

    Or, switch to Windows XP! :P

  2. Rajiv says:

    Gnome has disk usage analyzer. For windows its WinDirStat.

  3. Sathya says:

    @Rajiv Thanks for the update on GNOME. And yes, WinDirStat is a port of KDirStat to Windowa

  4. Rahul says:

    hey i would love to know more about ubuntu….anyways its a great open sourcing site! keep up the good work :)

    My blog – http://www.rahulm1992.blogspot.com

  5. Sathya says:

    ^ Thanks for the compliments :)

  6. David says:

    ‘Stumbled’ here today.

    FYI

    du -hac downloads/

    list (h) in human readable form (a) all files and (c) produce a grand total for the local directory ‘downloads.

    [dmcreynolds@host-192-168-30-82 ~]$ du -hac downloads/
    5.7M downloads/eclipsemessenger.zip
    86M downloads/eclipse-java-ganymede-SR1-linux-gtk.tar.gz
    8.8M downloads/apache-ant-1.7.1-bin.tar.gz
    92K downloads/GDM-DarkCleanLinux.tar.gz
    3.9M downloads/flash-plugin-10.0.12.36-release.i386.rpm
    64M downloads/jdk-6u11-linux-i586.rpm
    40K downloads/sun-javadb-common-10.4.1-3.1.i386.rpm
    908K downloads/sun-javadb-demo-10.4.1-3.1.i386.rpm
    4.4M downloads/sun-javadb-docs-10.4.1-3.1.i386.rpm
    188K downloads/sun-javadb-javadoc-10.4.1-3.1.i386.rpm
    116K downloads/provider_for_google_calendar-0.5.1-tb+sb.xpi
    19M downloads/jre-6u11-linux-i586.rpm
    2.1M downloads/lightning-0.9-tb-linux.xpi
    8.0K downloads/QA.p12
    7.8M downloads/axis-bin-1_4.tar.gz
    1.2M downloads/enigmail-0.95.7-tb+sm.xpi
    332K downloads/Klikit Dragon Blue.tar.gz
    480K downloads/sun-javadb-client-10.4.1-3.1.i386.rpm
    3.7M downloads/sun-javadb-core-10.4.1-3.1.i386.rpm
    207M downloads/
    207M total

  7. Sathya says:

    David, thanks for the tip :)

  8. [...] Re: Calling UNIX Gurus. Need help with a small query PHP Code: du -hac <directory>  > Find out how much space each file is occupying [...]

You can leave a response, or trackback from your own site.

Leave a Reply