Find the big directories lurking under the surface of your disk

View the Project on GitHub cgrayson/iceberg


Iceberg is the updated incarnation of a surprisngly useful tool that I originally wrote in Java, which makes it easy to find the big directories that are wasting space on your disks.

This version has two parts: a Bash script that generates an interactive HTML disk report, and the JavaScript and CSS that give it its interactivity. The latter, plus Bootstrap and jQuery, are loaded from the Internet, so you don't need to download them to use Iceberg.

This functionality has proven useful time and time again, not only on my Mac laptop, but also on the various Linux machines I work with. That's why the HTML generation is done by a Bash script, it seemed like a good choice for lowest-common denominator in those *nix environments. Usage on remote servers, where you may not have a GUI, is also the reason for splitting the report-generation part from the report-viewing part. Generate the HTML on the remote machine, download it locally, and pop it open in the browser of your choice.

Intallation & Usage

  1. Download the script:

  2. Make it executable:

    chmod +x

  3. Invoke the Bash script, specifying the directory to report on and saving the output to a file: ~/Movies > iceberg_movies.html

  4. Open the HTML file in your browser (after downloading it to your local machine if necessary). No need for a web server, just open the file directly. You can drag the file & drop it on your browser, cmd-O in your browser to open it, or on a Mac:

    open iceberg_movies.html

    It will look something like this:


    You can see a live, interactive sample page here.

  5. The page starts with directories 1GB or larger highlighted in red. Change that threshold with the size buttons at the top of the window.

  6. Click on folder/directory buttons to expand them and see their subdirectories. Directories with no subdirectories cannot be expanded (those buttons are deactivated).

  7. Find those directories with old backups, unneeded downloads, etc. that are wasting your disk space, and go clean them up.

  8. Repeat as desired. Remember, the HTML report is a static file. If you add or delete files, you'll need to re-run the Bash script, and refresh your browser.

  9. Options:

    -d du_input_filename
    Tells Iceberg to not run the du command, but instead to use the given input file. Useful for development testing, or if you want to get directory-size info from a remote machine without installing on it.
    Mainly for development testing: when generating the HTML, this option tells Iceberg to link local JavaScript and CSS, rather than the links to the latest versions on Iceberg's website as it normally does.
    Instructs Iceberg to create plain text output, rather than HTML. May be useful for small directory trees, especially on servers without web browsers handy.
    -t tmp_dir
    Specifies a temporary directory (the default is the current directory, aka ".") During operation, Iceberg creates a temporary file for the du output, which may be large. Note that the HTML output, which may also be large, can be placed elsewhere if necessary by using the output redirect (>).



Questions, problems, or suggestions? If you're on GitHub, then you can open an issue, fork, etc. from the project page there. If you're a normal person, your best bet is probably to contact me on Twitter at @cgrayson.