agedu is a Linux tool used to track down the wasted disk usage. This tool will help you to find out the right stuff to delete and free up your disk space.
It scans a directory tree and produces reports about how much disk space is used in each directory and sub directory, and also how that usage of disk space corresponds to files with last-access times a long time ago.
[email protected]:~$ sudo apt-get install agedu
Agedu package will not be found in official repositories. So first, add EPEL repository with the following command:
[[email protected] ~]# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
Now install Agedu with following command:
[[email protected] ~]# yum install agedu -y
<b>agedu</b> [ <em>options</em> ] <em>action</em> [<em>action</em>...]
If you want to scan your home directory for disk usage, the command should be:
[email protected]:~$ agedu -s /home/sk/
The above command will scan all directories, sub directories for disk usage and build a large data file called agedu.dat in your current directory. If that current directory is inside /home/sk, it is smart enough to discount its own index file.
The sample output will be as shown below:
Built pathname index, 28928 entries, 2505705 bytes of index Faking directory atimes Building index Final index file size = 9538096 bytes
Now run the following command to see the reports:
[email protected]:~$ agedu -w
You will see an output like shown below:
Using Linux /proc/net magic authentication URL: http://127.0.0.1:46389/
Open up your browser and enter the URL http://127.0.0.1:46389/ shown in the above output.
The above graphical output shows the disk usage of the /home/sk directory in various colors. You can figure out which files/directories should be removed to free up the disk usage from the above output. Click on any directory to view the disk usage of its sub directories. To exit from the command, just press CTRL+D.
Assign custom port for Agedu
Use the following command to assign the custom port for Agedu:
[email protected]:~$ agedu -w --address 127.0.0.1:9000
[email protected]:~$ agedu -w --address 192.168.1.100:9000
Here 192.168.1.100 is my local IP address. You may see the following output after entering the above command:
Using Linux /proc/net magic authentication URL: http://127.0.0.1:9000/
Now you will able to access the Agedu web interface with URL http://127.0.0.1:9000 from your browser. To exit from Agedu command press CTRL+D.
Enable password protection for Agedu
You can secure Agedu web interface with a password. Use the following command to generate a password:
[email protected]:~$ agedu -w --address 127.0.0.1:9000 --auth basic
You may have the following output. Note down the username and password:
Username: agedu Password: gehs92b5rf2y83mc URL: http://127.0.0.1:9000/
It will create a username and password automatically for you. Open up the browser and navigate to http://127.0.0.1:9000. It will ask the username and password as shown below. Enter the username and password.
You can set a custom username and password if you like. To do so, enter the following command:
[email protected]:~$ agedu -w --address 127.0.0.1:9000 --auth basic --auth-fd 0
Now enter your username and password in the following format:
You should enter the username (eg. sk) and put a colon (:) and password (eg. password). Afterwards, press CTRL+D to exit. Now you will be able to access Agedu web interface with new username and password.
View Agedu reports from terminal
To view the reports from the terminal, use the following command:
[email protected]:~$ agedu -t /home/sk/
You may see the following like output:
25606780 /home/sk/Personal 384 /home/sk/Pictures
To access files which are not looked(accessed) for six months or more, use the following command:
[email protected]:~$ agedu -t /home/sk/ -a 6m
You can use the switches d for days, w for weeks, m for months and y for years. For example, if you want to see the files which are not accessed 7 days or more, enter the following command:
[email protected]:~$ agedu -t /home/sk/ -a 7d
View reports of a particular types of files
For example, if you want to see the disk usage taken by PDF files and want to omit all other files, just enter the following command:
[email protected]:~$ agedu -s . --exclude '*' --include '*.pdf'
The above command will scan only for disk usage taken by PDF files in the current directory and it omit all other types of files from scanning.
To view the report, enter the following command:
[email protected]:~$ agedu -w Using Linux /proc/net magic authentication URL: http://127.0.0.1:52272/
Open up browser and navigate to URL http://127.0.0.1:52272/. Now you will see the output only for disk usage taken by PDF files.
[email protected]:~$ agedu -s /home/sk/Downloads --exclude '*' --include '*.pdf'
The above command scans PDF files in the /home/sk/Downloads and omits all other directories and file types.
Deleting unused files
You have found out which directory is not using for long time, you can simply delete the directory or multiple directories with following command to free up the disk space:
[email protected]:~$ rm -fr directoryname
To delete the index file, enter the following command:
[email protected]:~$ agedu -R
rm -fr agedu.dat
To know more Agedu commands, refer the man pages.
[email protected]:~$ man agedu