Today, let us talk about a simple, yet another must-have utility in your arsenal. Meet agedu, a small utility that tracks down the wasted disk space in your Linux system. Running out of disk space? No worries! Install agedu and find out which directories or files are consuming more space. Just delete them if they are no longer needed or move them safely to an archive medium to free up some space. It works on Windows and Unix-like operating systems. It is available under MIT license.
Agedu works just like as du command. It scans your hard disk and displays the result in the Terminal window. Since it has built-in web server, it displays the result as a neatly organized HTML report in different colors in your web browser. Red color represents the data that has been accessed a long time ago, Green represents the recently accessed data, and the spectrum through orange and yellow represents points in between. So, we can immediately get a grasp of which directories and files have been used frequently and which data have been stagnated. Once we find out the stagnated data, we can delete or move them to an external media. Sounds fair enough? Right. Let us see how to use it with some practical examples.
In Arch Linux and its derivatives, Agedu is available in AUR. So you can install it using any AUR helper programs, for example Yay.
$ yay -S agedu
Agedu is available in the default repositories of most DEB based systems like Ubuntu, Linux Mint. To install it, open up the Terminal and run:
$ sudo apt-get install agedu
On RPM based distributions like RHEL, CentOS, Scientific Linux and Fedora, install EPEL repository using command:
$ sudo yum install epel-release
And then, install agedu as shown below.
$ sudo yum install agedu
Find Out Wasted Disk Space In Linux Using Agedu
The usage of agedu utility is trivial. The syntax of agedu is:
agedu [ options ] action [action...]
Let us see some examples.
Open the Terminal and run the following command to scan $HOME directory.
$ sudo agedu -s /home/sk/
Built pathname index, 13 entries, 1376 bytes of index Faking directory atimes Building index Final index file size = 2600 bytes
View reports in Terminal
Now, let us generate the report. To do so, run:
$ sudo agedu -t /home/sk/
32 /home/sk/.cache 8 /home/sk/.ssh 64 /home/sk
Let us narrow down the report more specifically. Say for example, to list the files which are not viewed or accessed for last 2 days and more, run:
$ sudo agedu -t /home/sk/ -a 2d
32 /home/sk/.cache 8 /home/sk/.ssh 48 /home/sk
Similarly, just replace letter “d” with “w” for weeks, “m” for for months, “y” for years.
Say for example, to view the files which are not accessed for the past two weeks, run:
$ sudo agedu -t /home/sk/ -a 2w
View reports of particular file types
The good thing of agedu is it offers variety of useful features to tracj down the disk usage. One among them is view reports of a particular file type.
For example, let us generate the report of txt files using command:
$ sudo agedu -s . --exclude '*' --include '*.txt'
Built pathname index, 6 entries, 649 bytes of index Faking directory atimes Building index Final index file size = 1064 bytes
The above command will scan the disk usage taken only by txt files and excludes all other files in the entire hard drive.
Likewise, to scan a particular path, just specify it as shown below.
$ sudo agedu -s /home/sk/ --exclude '*' --include '*.txt'
To view the report, run:
$ sudo agedu -t /home/sk/
View reports in Web browser
To generate HTML report and view it on the web browser, run:
$ sudo agedu -w --auth none
You can use just “sudo agedu -w”, however “–auth none” option will eliminate the 403 forbidden error.
The HTML report of disk usage has been generated. Let us take a look at it. Open up your web browser and point it to http://localhost:46484 or http://IP-Address:46484. Please note that different port number will be generated each time you run this command.
Click on any directory to view its sub directories disk usage.
As you see above, the most used disk space is showed on the top followed by subsequent smaller results. To end this command, press CTRL+D.
Once you find out data which are no longer used for a long time, you can just delete them or move them to any external medium.
Configure password protection for Agedu web interface
Agedu web interface doesn’t has authentication by default. However, It allows us to enable password protection to view the reports in web browser.
Enter the following command to generate a password to access agedu’s web interface.
$ sudo agedu -w --address localhost:46484 --auth basic
You may have the following output. Note down the username and password:
Username: agedu Password: agid01c6sg3z94nd URL: http://locahost:46484/
The above command will automatically create a username with password.
Now, open your web browser and point it to http://locahost:46484. This time it will ask you to enter the username and its password.
If you entered the valid username password, you can access the agedu web interface, else you can’t.
I don’t like the default username and password. I want to define my own. Can I be able to do that? Of course you can.
To set a custom username with password, run:
$ sudo agedu -w --address locahost:46484 --auth basic --auth-fd 0
Next, enter your custom user and its password as shown below.
Here ostechnix is my username and its password is password. It’s just an example. I recommend you to use a strong password.
Then, press CTRL+D to exit and return back to Terminal.
From now, you can access the agedu’s web interface using your custom username and password.
Change the default port for Agedu
As you see before, agedu serves the result via different random ports each time. You can change it to a particular port of your liking if you want to.
To change the port for agedu, run:
$ sudo agedu -w --address localhost:1234 --auth none
Here 1234 is the custom port.
Or just specify the actual IP address.
$ sudo agedu -w --address 192.168.43.2:1234
Now, you can view the report by visiting the URL – http://localhost:1234 or http://192.168.43.2:1234 from your browser. To exit the from above command and return back to Terminal, press CTRL+D.
That’s it. For more details, visit the man pages.
$ man agedu