Nowadays, saving disk space is crucial, especially when you are using small SSD drives.

Having terabytes of storage might be a good news, however you still need to cleanup your system when it is full. But if you have small storage (for example a 128GB SSD), cleanup operation is crucial.

So, let me introduce you a few operations to free up your drives.

Check the disk usage

Checking the remaining free space is relatively easy to perform. Just open a terminal and put this command:

manoaratefy@manoaratefy-hb ~ $ df -h
Filesystem                  Size  Used Avail Use% Mounted on
udev                        1,9G     0  1,9G   0% /dev
tmpfs                       381M   11M  370M   3% /run
/dev/sda5                    39G   34G  3,0G  92% /
tmpfs                       1,9G   71M  1,8G   4% /dev/shm
tmpfs                       5,0M  4,0K  5,0M   1% /run/lock
tmpfs                       1,9G     0  1,9G   0% /sys/fs/cgroup
/dev/sda3                   243G  233G   11G  96% /media/manoaratefy/01D265B03B445870
cgmfs                       100K     0  100K   0% /run/cgmanager/fs
tmpfs                       381M   40K  381M   1% /run/user/1000
/home/manoaratefy/.Private   39G   34G  3,0G  92% /home/manoaratefy
/dev/sdb1                    49G   20G   30G  40% /media/manoaratefy/1270656770655311
/dev/sdb2                   883G   57G  827G   7% /media/manoaratefy/09D30A9C2E2F32F7

As you see, each filesystem is listed with its human readable format of capacity (total, free, used).

1. Remove unused dependency packages

Sometimes, you install packages and after you remove them when you don’t need anymore. The package is really removed, but during the installation, some dependency package were installed. If these packages are not anymore used by any other application, you can safely remove them.

sudo apt-get autoremove

2. Clean up APT cache

APT cache store all downloaded packages. These files are not anymore needed once your installation is done. Let’s firstly check how much they eat on your disk:

sudo du -sh /var/cache/apt

Then, let’s safely remove them:

sudo apt-get autoclean

to remove outdated packages, or

sudo apt-get clean

to remove all packages.

3. Clean thumbnails

Thumbnails on your File Manage is stored under ~/.cache/thumbnails and some of them might be unused.

To get its size:

du -sh ~/.cache/thumbnails

To remove them safely:

rm -rf ~/.cache/thumbnails/*

4. Remove old kernels

When Linux upgrade its kernel, old version is not removed due to security reasons. If the upgrade fails, you can move easily to the old version on the bootloader.

However, it is safe to store only 2 versions of Linux kernel: currently used and its predecessor. It’s enough if your currently used Linux kernel version is stable for your usage.

To get list of installed kernels:

sudo dpkg --list 'linux-image*'

Kernel can be removed like a generic package:

sudo apt-get remove linux-image-VERSION

5. Remove unused applications

You can remove unused applications to free up your storage. Depending on its installation method, reverse operation may differ. It you were using an .deb package or were using APT to install your application, you should be able to remove it with one-line command:

sudo apt-get remove << package-name >>

Leave a Reply

Your email address will not be published. Required fields are marked *