Let us consider an example for an undergraduate user named foo, who is over disk quota and has received email warnings.
Step 1. Determine your total disk usage.
Enter the following command to calculate total disk usage in KB blocks:
cd; du -sk .
The command would take some time, and returns:
10000000
We see that the command returns 1000000 KB blocks. Now since the user foo is an undergraduate user, the limit is 8000000 KB blocks. So 2000000 KB (~2G) of stuff needs to be cleaned up.
Step 2. Find the largest sub-directories or files in the home directory
Use the command below to list the usage:
cd; du -sh * .??* | sort -rh | more
Let’s assume the command shows an output like:
1.6G .cache
1.2G Downloads
48M Desktop
34M Pictures
We see that there is ~1.6G of data under the .cache
directory and another 1.2G in Downloads
.
So, we need to start working from here.
Step 3. Go into the first largest sub-directory
Go into .cache
, and run the du
command:
cd .cache; du -sh * .??* | sort -rh | more
Assume the command returns with:
1.2G google-chrome
300M mozilla
38M tracker
25M thumbnails
23M composer
We see that google-chrome
directory is taking more than a gigabyte of disk space.
It can be deleted safely, via:
rm -rf google-chrome
Step 4. Keep repeating Step 3 for next largest sub-directories/files
In this example, we’ll do this once more.
Let’s now go into Downloads
, and run the same du
command:
cd ~/Downloads; du -sh * .??* | sort -rh | more
Let’s say the command shows the following output this time:
1.1G colinux.1.3.37.tar.gz
70M treble.zip
37M image.pdf
23M copy.jpeg
Assume that we determine the file colinux.1.3.37.tar.gz
, which is taking up more than a gigabyte can be deleted.
Delete this file by the command:
rm colinux.1.3.37.tar.gz
Step 5. Repeat Step 1
Now let’s do Step 1 to see how much disk the user foo is using:
cd; du -sh .
The command would take some time, and returns:
7.7G
We see that the user foo is under the disk quota now.