Diskpie

diskpie displays a pie chart showing the total disk usage of the current working directory and how it is divided among subdirectories. You invoke it from the Mac OS X, Linux, or FreeBSD command line and it opens up a window describing the current working directory. It requires Perl and Java.

pie chart

The chart sorts the pie wedges, biggest first, and colors the wedges with different colors. The chart is titled with the directory and machine name at the top, and subtitled with the total size at the bottom. Each wedge is titled with the directory name and total size contained in the directory, if it's big enough. The files not in any subdirectory are collected as "(loose)".

To use it, in a shell window, type

	cd wherever
	diskpie
      

The way diskpie works is that the Unix "du" command is called to list disk usage. The output of this command is piped into a Perl program, which writes out a little HTML page and calls Appletviewer to display it. Appletviewer runs the Java applet "Pie" to display the chart.

To install this on your machine,

  1. download the tarfile diskpie.tar.gz
  2. extract it using Stuffit Expander (Mac OS X) or tar -zxf diskpie.tar.gz (Unix/Linux/OSX)
  3. copy the contents to your bin directory in your home directory. This will give you
    • Pie.class
    • PieItem.class
    • PieView.class
    • piedisp (Perl program)
    • diskpie (shell script)
  4. make sure that piedisp and diskpie are executable, and make sure your "bin" is in your search path.

This version is set up to work on Mac OS X. For Linux, edit the shell script "diskpie" to read

	du --max_depth=1 | piedisp
      
instead of
	du -d 1 -k | piedisp
      

(You could probably get this working on a Windows box, if you installed Cygwin, Perl, and Java, and changed the shell script to be a BAT file.)

This little hack uses the pie chart class I wrote for web applications. Source and object are separately available.

03/08/04