I have very recently installed Ubuntu 15.10. I have been watching the available amount of memory over two days, and i noticed that the free memory goes on decreasing at a slow rate. Initially the used memory was 5GB, Then it went on increasing to 6 to 6.5 and now it stands around 6.8. I haven't installed anything significant over this period (except some small packages worth a few MBs) .My home folder is just few 100kbs. What is eating up my disk space? How can find out if something is going on?
The indicated amount seems to be .deb cache in majority. Issue this command:
sudo apt-get clean
and after that check again the disk usage.
You can find out how much space sub-directories occupy using the following command:
sudo du -hxd 1 YOUR_PATH 2>/dev/null | sort -hr
What it does:
sudo: run the
ducommand as root - only needed/recommended if you want to list stuff outside your own home directory.
du: disk usage analyzing tool. Arguments:
-h: use human readable numeric output (i.e. 2048 bytes = 2K)
-x: stay on the same file system, do not list directories which are just mounted there
-d 1: display recursion depth is set to 1, that means it will only print the given directory and the direct subdirectories.
YOUR_PATH: The path which should be analyzed. Change this to whatever path you want.
2>/dev/null: we do not want error output (e.g. from when it tries to get the size of virtual files), so we pipe that to the digital nirvana a.k.a. /dev/null.
|: use the output of the previous command as input for the next command
sort: sort the input. Arguments:
-h: recognize numbers like 2K and sort them according to their real value
-r: reversed order: print the largest numbers first
Example for my file system root
$ sudo du -hxd 1 / 2>/dev/null | sort -hr 5,7G / 4,0G /usr 1,3G /var 358M /lib 49M /opt 15M /etc 13M /sbin 13M /bin 840K /tmp 32K /root 16K /lost+found 8,0K /media 4,0K /srv 4,0K /mnt 4,0K /lib64 4,0K /cdrom
Note that the given directory's total size is also included, not only the subdirectories.