Agedu – A Most Useful Tool for Tracking Down Wasted Disk Space in Linux

Posted by

 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.

Assume you are running short on disk space and you wanted to free up, by searching something that’s a waste of space and removing it or moving it to an archive medium. How do you track down right stuff to delete, that saves maximum space?

Linux provides a standard du command, which scans entire disk and shows you which directories hold the huge amount of data. That can assist you narrow your search to the things most useful deleting.

However, that only shows you what’s huge. What you actually want to know is what’s too huge. By default, du command will not let you differentiate between data that’s huge because you are doing something that needs it to be huge, and data that’s huge because you unpacked it once and ignored about it.

Most Linux file systems, by default only shows when a file was last accessed, but not shown when it was written, modified or even read. So if you created a huge amount of data years ago, forgot to delete it and have never used it since, then it is important to use those last-access time stamps to know the difference between used and unused data.

Agedu pronounced as (age dee you) is an open source and free utility (much like du command) that helps system administrators to track down wasted disk space used by old files and delete them to free up some space.

Agedu does a complete scan and produces reports that shows how much disk space is utilized by each directory and sub directory along with the last-access times of files. In simple words, it simply helps you to free up disk space.

Agedu Features

  1. Creates graphical reports.
  2. Produces data output in HTML format.
  3. Generates HTML reports with hyperlinks to other directories for easy navigation to gather reports.
  4. Provides more configurable options.

How Does Agedu Works?

From the man page:

agedu is a program which does this. It does basically the same sort of disk scan as du, but it also records the last-access times of everything it scans. Then it builds an index that lets it efficiently generate reports giving a summary of the results for each subdirectory, and then it produces those reports on demand.

How to Install Agedu in Linux Systems

On Debian/Ubuntuagedu is available to install from the default system repositories using following apt-get command as shown.

$ sudo apt-get install agedu

On RHEL/CentOS, you need to turn on EPEL repository to install Agedu using following yum command as shown.

# yum install epel-release
# yum install agedu

Fedora and Arch Linux users, simply type the following command to install Agedu.

$ sudo dnf install agedu  [On Fedora]
$ sudo yaourt -S agedu    [On Arch Linux]

On other Linux distributions, you can compile Agedu from source as shown.

$ wget
$ tar -xvf agedu-20180329.af641e6.tar.gz
$ cd agedu-20180329.af641e6
$ ./configure
$ make
$ sudo make install

How to Track Wasted Disk Space Using Agedu

The following command will do a complete scan of /home/linuxtechexpert directory and its sub-directories and creates a special index file containing its data structure.

# agedu -s /home/linuxtechexpert/

Scan Linux System for Disk Space

Built pathname index, 232578 entries, 22842517 bytes of index                                                                                                                
Faking directory atimes
Building index
Final index file size = 97485984 bytes

Next, type the following command to query newly created index file.

# agedu -w
Sample Output :
Using Linux /proc/net magic authentication
URL: http://localhost:34895/

Now, type the following command to open the URL using any web browser.

# http://localhost:34895/
Graphical Output :

The below screen shows the graphical representation of disk usage of /home/linuxtechexpert along with its sub directories using various colors to show the difference between disused and recently accessed data.

Click on any sub directory to see the reports of its sub-directories. To terminate this mode, just press [CTRL+D] on command line.

Linux Disk Space Usage

To create and set custom port number for agedu, type the following command.

# agedu -w --address
Sample Output :
Using Linux /proc/net magic authentication

Enable password protection for Agedu using the following command.

# agedu -w --address --auth basic

Agedu Password Protect Reports

Username: agedu
Password: n2tx16jejnbzmuur
Password Protect Agedu
Linux Directory Disk Space Usage

Access Agedu reports using terminal mode.

# agedu -t /home/linuxtechexpert

Show Disk Space Usage in Terminal

8612        /home/linuxtechexpert/.AndroidStudio3.1
3684        /home/linuxtechexpert/.PlayOnLinux
604         /home/linuxtechexpert/.ScreamingFrogSEOSpider
2416        /home/linuxtechexpert/.TelegramDesktop
61960       /home/linuxtechexpert/.Write
1508        /home/linuxtechexpert/.adobe
20          /home/linuxtechexpert/.aptitude
48          /home/linuxtechexpert/.byobu
1215948     /home/linuxtechexpert/.cache
3096        /home/linuxtechexpert/.cinnamon
1421828     /home/linuxtechexpert/.config
12          /home/linuxtechexpert/.dbus
8           /home/linuxtechexpert/.emacs.d
780         /home/linuxtechexpert/.fonts

You see the output similar to du command. Let’s see the old files which are not accessed for long time. For example, to see only old files that are not accessed in last 12 months or more.

# agedu -t /home/linuxtechexpert -a 12m

Show Files Not Accessed in Last 12 Months

2416        /home/linuxtechexpert/.TelegramDesktop
1500        /home/linuxtechexpert/.adobe
46776       /home/linuxtechexpert/.cache
1840        /home/linuxtechexpert/.cinnamon
142796      /home/linuxtechexpert/.config
636         /home/linuxtechexpert/.gconf
88          /home/linuxtechexpert/.gimp-2.8
12          /home/linuxtechexpert/.gnome
112         /home/linuxtechexpert/.java
108         /home/linuxtechexpert/.kde
8           /home/linuxtechexpert/.links2
16          /home/linuxtechexpert/.linuxmint
6804        /home/linuxtechexpert/.local
12          /home/linuxtechexpert/.mindterm
40920       /home/linuxtechexpert/.mozilla
4           /home/linuxtechexpert/.oracle_jre_usage
12          /home/linuxtechexpert/.parallel
24          /home/linuxtechexpert/.shutter
6840        /home/linuxtechexpert/.softmaker
336         /home/linuxtechexpert/.themes

Let’s find out how much disk space taken by MP3 files by using following command.

# agedu -s . --exclude '*' --include '*.mp3'

Again to see reports run the following command.

# agedu -w

To deleted files and free up disk space, use the following command.

# rm -rf /downloads/*.mp3

How to remove agedu index file? First see the size of the index file with the following command.

# ls agedu.dat -lh
Sample output :
-rw------- 1 linuxtechexpert linuxtechexpert 35M Apr 10 12:05 agedu.dat

To remove index file, just enter.

# agedu -R

For more information on agedu command options and usage, please read the man pages or visit agedu home page.

# man agedu

Leave a Reply

Your email address will not be published. Required fields are marked *