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 show how much disk space is utilized by each directory and subdirectory along with the last-access times of files. In simple words, it simply helps you to free up disk space.
Agedu Features:
- Creates graphical reports.
- Produces data output in HTML format.
- Generates HTML reports with hyperlinks to other directories for easy navigation to gather reports.
- 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/Ubuntu, agedu 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 https://www.chiark.greenend.org.uk/~sgtatham/agedu/agedu-20180329.af641e6.tar.gz $ 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/rootadminz directory and its sub-directories and creates a special index file containing its data structure.
# agedu -s /home/rootadminz/
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 the 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/
The below screen shows the graphical representation of disk usage of /home/rootadminz along with its subdirectories using various colours to show the difference between disused and recently accessed data.
Click on any subdirectory to see the reports of its sub-directories. To terminate this mode, just press [CTRL+D] on the command line.
To create and set the custom port number for agedu, type the following command.
# agedu -w --address 127.0.0.1:8081
Sample Output : ----------------------------------------------
Using Linux /proc/net magic authentication URL: http://127.0.0.1:8081/
Enable password protection for Agedu using the following command.
# agedu -w --address 127.0.0.1:8081 --auth basic
Agedu Password Protect Reports Username: agedu Password: n2tx16jejnbzmuur URL: http://127.0.0.1:8081/
Access Agedu reports using terminal mode.
# agedu -t /home/rootadminz
Show Disk Space Usage in Terminal -------------------------------------------------------------------
8612 /home/rootadminz/.AndroidStudio3.1 3684 /home/rootadminz/.PlayOnLinux 604 /home/rootadminz/.ScreamingFrogSEOSpider 2416 /home/rootadminz/.TelegramDesktop 61960 /home/rootadminz/.Write 1508 /home/rootadminz/.adobe 20 /home/rootadminz/.aptitude 48 /home/rootadminz/.byobu 1215948 /home/rootadminz/.cache 3096 /home/rootadminz/.cinnamon 1421828 /home/rootadminz/.config 12 /home/rootadminz/.dbus 8 /home/rootadminz/.emacs.d 780 /home/rootadminz/.fonts ...
You see the output similar to du command. Let’s see the old files which are not accessed for a long time. For example, to see only old files that are not accessed in the last 12 months or more.
# agedu -t /home/rootadminz -a 12m
Show Files Not Accessed in Last 12 Months ------------------------------------------------------------------------------------ 2416 /home/rootadminz/.TelegramDesktop 1500 /home/rootadminz/.adobe 46776 /home/rootadminz/.cache 1840 /home/rootadminz/.cinnamon 142796 /home/rootadminz/.config 636 /home/rootadminz/.gconf 88 /home/rootadminz/.gimp-2.8 12 /home/rootadminz/.gnome 112 /home/rootadminz/.java 108 /home/rootadminz/.kde 8 /home/rootadminz/.links2 16 /home/rootadminz/.linuxmint 6804 /home/rootadminz/.local 12 /home/rootadminz/.mindterm 40920 /home/rootadminz/.mozilla 4 /home/rootadminz/.oracle_jre_usage 12 /home/rootadminz/.parallel 24 /home/rootadminz/.shutter 6840 /home/rootadminz/.softmaker 336 /home/rootadminz/.themes ....
Let’s find out how much disk space taken by MP3 files by using the 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 rootadminz rootadminz 35M Apr 10 12:05 agedu.dat
To remove the index file, just enter.
# agedu -R