June 23, 2010 · General · Email This Post

Sponsored Link
agedu scans a directory tree and produces reports about how much disk space is used in each directory and subdirectory, and also how that usage of disk space corresponds to files with last-access times a long time ago.
In other words, agedu is a tool you might use to help you free up disk space. It lets you see which directories are taking up the most space, as du does; but unlike du, it also distinguishes between large collections of data which are still in use and ones which have not been accessed in months or years – for instance, large archives downloaded, unpacked, used once, and never cleaned up. Where du helps you find what's using your disk space, agedu helps you find what's wasting your disk space.

agedu has several operating modes. In one mode, it scans your disk and builds an index file containing a data structure which allows it to efficiently retrieve any information it might need. Typically, you would use it in this mode first, and then run it in one of a number of ‘query’ modes to display a report of the disk space usage of a particular directory and its subdirectories. Those reports can be produced as plain text (much like du) or as HTML. agedu can even run as a miniature web server, presenting each directory's HTML report with hyperlinks to let you navigate around the file system to similar reports for other directories.

Install agedu in ubuntu

sudo apt-get install agedu

Using agedu

So you would typically start using agedu by telling it to do a scan of a directory tree and build an index. This is done with a command such as

$ agedu -s /home/test

which will build a large data file called agedu.dat in your current directory. (If that current directory is inside /home/test

Having built the index, you would now query it for reports of disk space usage. If you have a graphical web browser, the simplest and nicest way to query the index is by running agedu in web server mode:

$ agedu -w

which will print (among other messages) a URL on its standard output along the lines of

URL: http://127.0.0.1:48638/

That URL will always begin with ‘127.’, meaning that it's in the localhost address space. So only processes running on the same computer can even try to connect to that web server, and also there is access control to prevent other users from seeing it.

Now paste that URL into your web browser, and you will be shown a graphical representation of the disk usage in /home/test and its immediate subdirectories, with varying colours used to show the difference between disused and recently-accessed data. Click on any subdirectory to descend into it and see a report for its subdirectories in turn; click on parts of the pathname at the top of any page to return to higher-level directories. When you've finished browsing, you can just press Ctrl-D to send an end-of-file indication to agedu, and it will shut down.

After that, you probably want to delete the data file agedu.dat, since it's pretty large. In fact, the command agedu -R will do this for you; and you can chain agedu commands on the same command line, so that instead of the above you could have done

$ agedu -s /home/test -w -R

for a single self-contained run of agedu which builds its index, serves web pages from it, and cleans it up when finished.

If you don't have a graphical web browser, you can do text-based queries as well. Having scanned /home/test as above, you might run

$ agedu -t /home/test

which again gives a summary of the disk usage in /home/test and its immediate subdirectories; but this time agedu will print it on standard output, in much the same format as du. If you then want to find out how much old data is there, you can add the -a option to show only files last accessed a certain length of time ago. For example, to show only files which haven't been looked at in six months or more:

$ agedu -t /home/test -a 6m

That's the essence of what agedu does. It has other modes of operation for more complex situations, and the usual array of configurable options. The following sections contain a complete reference for all its functionality.

Sponsored Link

Incoming search terms:

Related posts

5 Comments to “agedu – Simple utility for tracking down wasted disk space”

  1. anonymous coward says:

    Hi,

    a simple

    du –max-depth=1 –one-file-system –all -k | sort -n

    will also do the job. I wonder how far this GUIfication madness will go … Will it end with 1000s or 10000s or 100000s of specialized tools that will waste your diskspace

    [Reply]

  2. Aleve Sicofante says:

    I wonder how far this terminal obsession will go. Will it end with 1000s, 10000s or 100000s of specialized commands that will waste your brains for no good?

    The standard disk analyzer (Baobab) in GNOME does this for human beings, just SO MUCH BETTER.

    [Reply]

  3. Pétur Ingi says:

    ‘du’ is nice and works like a charm.
    It’s also more customizable (weekly alerts when combined with crontab, just for an example), and it can be scripted.

    GUI tools using independent libraries are waste of space, huge security risk and they goes against rule number 2 in the ‘Unix philosophy’ which states “Make each program do one thing well.”

    GUI is nice, as long as it’s only a front-end to currently existing applications.
    To many programmers out there are reinventing the wheel, only to be able to write their name on every copy of it.

    [Reply]

  4. Curly Joe says:

    du –max-depth=1 –one-file-system –all -k | sort -n

    You might check where a single “-” should be used and where a doulbe “–” is required. Mixing them is never a good idea as this kind of mistake will then happen.

    [Reply]

  5. Spell checkers often swap out two – for a single -

    [Reply]

Leave a Reply