How to Free Up Space on Ubuntu 20.04

Ubuntu is a great operating system, but one of the problems it has is that it uses lots of space. This tutorial will show you how to free up some space on Ubuntu 20.04 and make your computer run more smoothly.

Remove Old Kernels (If No Longer Required)

One of the easiest ways to free up space on Ubuntu is by removing the old Linux kernel. Ubuntu keeps the old Linux kernel so that you can switch back to an older version of the Linux kernel if the new one is not compatible with your system.

To remove the old Linux kernel, run:

sudo apt autoremove --purge

Note that this command will only remove kernels that a) are no longer needed and b) were installed from the Ubuntu archive through system updates. If you install kernels manually or through a third-party PPA you’ll need to get your hands dirty.

Uninstall Apps & Games You Never Use (And Be Honest!)

Chances are you have a number of apps installed that you never use. Maybe you installed them on the back of an awesome review, out of nosiness, or to handle a particular task.

Whatever the excuse, if an app is no longer needed, but more space is, don’t be afraid to uninstall it.

Typical apps you may wish to expunge include web browsers (are you ever going to use Opera, Epiphany, Midori, and Min?), music players (heck knows there’s enough of ’em), and games that sounded good in the Steam Store description but ended up being as much fun as a Windows 10 update combo.

And everyone has LibreOffice Draw knocking about doing nothing!

Don’t lie to yourself about might-needs, and could-dos. The beauty of most software is that it’s not going anywhere anytime soon. This is never truer than on Linux, where most apps are just an apt install command away.

To remove a specific app by name run:

sudo apt remove package1 package2

To remove packages and dependencies that are no longer required (because you’ve uninstalled other packages or newer versions have replaced them) run the following command:

sudo apt autoremove

Stay up to date (seriously, do it!)

The most obvious step on this list is also the one few people would think to recommend. Unlike Windows, where every new update adds more overhead, package updates on Linux regularly free space rather than use it.

Delete Cached Packages

If you have installed any software using the Ubuntu software center, then it will download the .deb package of the software and store it in the cache. This is done so that you can install that software again without downloading it from the internet.

You can delete the cached .deb packages using the following command:

sudo apt clean

Delete Log Files

Log files are created by various programs to store information about their activities.

If your system is running out of space, then you can delete the log files to free some space.

To delete the log files, run:

sudo rm -rf /var/log/*

Delete Temporary Files

The system also creates temporary files. These temporary files are deleted automatically when their task is completed. But sometimes, these files are not deleted and they take up space on your system.

To delete all temporary files, run:

sudo rm -rf /tmp/*

Delete Unused Packages

If you have installed some software using the apt command and then uninstalled it, the apt-cache still keeps the .deb package of that software.

To delete those .deb packages, run:

sudo apt autoremove

Delete Orphan Packages

The orphan packages are the packages that are no longer required by any other package but are still installed on your system.

To delete the orphan packages, run:

sudo apt autoremove –purge

Delete Local Packages

If you have downloaded the .deb packages of any software, then they are stored in the /var/cache/apt/archives folder.

To delete all .deb packages stored in the /var/cache/apt/archives folder, run:

sudo apt clean

Delete Old Packages

If you have upgraded to a new version of Ubuntu, then there might be some old packages that are no longer required by the new version of Ubuntu.

To delete those old packages, run:

sudo apt autoremove

Delete Thumbnail Cache

The Thumbnail cache is created by Ubuntu when you view the images in the file manager.

To delete the thumbnail cache, run:

sudo rm -rf ~/.cache/thumbnails/*

Delete Old Snapshots

If you have used the time shift feature of Ubuntu, then it will create snapshots of your system. These snapshots are stored in the /var/lib/timeshift folder.

To delete old snapshots, run:

sudo rm -rf /var/lib/timeshift/*

Delete Crash Reports

If you have installed the whoopsie package, then it will send crash reports to Ubuntu for analysis.

These crash reports are stored in the /var/crash folder.

To delete all crash reports, run:

sudo rm -rf /var/crash/*

Delete Apport Crash Reports

If you have installed the apport package, then it will send crash reports to Ubuntu for analysis.

These crash reports are stored in the /var/crash folder.

To delete all crash reports, run:

sudo rm -rf /var/crash/*

Delete Package Config Files

When you install a package using the apt command, it creates some package config files. These package config files are stored in the /var/lib/dpkg/info folder.

To delete these package config files, run:

sudo rm -rf /var/lib/dpkg/info/*

Delete Apt Overlay Files

When you install a package using the apt command, it stores the .deb files in the /var/cache/apt/archives folder.

To delete these .deb files, run:

sudo rm -rf /var/cache/apt/archives/*

Delete the Package Lists

Package lists are the files that contain the list of all the available packages.

To delete the package lists, run:

sudo rm -rf /var/lib/apt/lists/*

Delete the Package Lock Files

Package lock files are the files that are created to prevent the corruption of the apt database.

To delete the package-lock files, run:

sudo rm -rf /var/lib/dpkg/lock/*

Delete Apt Extras Files

Apt extras files are the files that are created by the apt-extras package.

To delete the apt extras files, run:

sudo rm -rf /var/lib/apt-extras/*

Delete the Package Cache Files

Package cache files are the files that contain the list of all the cached packages.

To delete the package cache files, run:

sudo rm -rf /var/cache/apt/pkgcache.bin/*

Delete the Package Status Files

Package status files are the files that contain the status of all the packages.

To delete the package status files, run:

sudo rm -rf /var/lib/dpkg/status/*

Delete the Package Triggers Files

Package triggers files are the files that contain information about package triggers.

To delete the package triggers files, run:

sudo rm -rf /var/lib/dpkg/triggers/*

Delete the Package Translations Files

Package translations files are the files that contain information about package translations.

To delete the package translations files, run:

sudo rm -rf /var/lib/dpkg/available-translations/*

Delete the Package Updates Files

Package updates files are the files that contain information about package updates.

To delete the package updates files, run:

sudo rm -rf /var/lib/dpkg/updates/*

Delete the Package Lock Files

Package lock files are the files that are created to prevent the corruption of the apt database.

To delete the package lock files, run:

sudo rm -rf /var/lib/dpkg/lock/*

Delete the APT Cache Files

APT cache files are the files that contain information about the cached packages.

To delete the APT cache files, run:

sudo rm -rf /var/cache/apt/archives/partial/*

Delete the Package Index Files

Package index files are the files that contain information about the available packages.

To delete the package index files, run:

sudo rm -rf /var/lib/apt/lists/partial/*

Delete the Package Installer Files

Package installer files are the files that are used by the apt package manager to install the packages.

To delete the package installer files, run:

sudo rm -rf /var/lib/dpkg/info/partial/*

Delete the Package Status Files

Package status files are the files that contain the status of all the packages.

To delete the package status files, run:

sudo rm -rf /var/lib/dpkg/status-old/*

Delete the Package Lock Files

Package lock files are the files that contain information about the locked packages.

To delete the package-lock files, run:

sudo rm -rf /var/lib/dpkg/lock-frontend/*

Delete the Package Translations Files

Package translations files are the files that contain information about the translations of the packages.

To delete the package translations files, run:

sudo rm -rf /var/lib/dpkg/available-translations-old/*

Delete the Package Updates Files

Package updates files are the files that contain information about the updates of the packages.

To delete the package updates files, run:

sudo rm -rf /var/lib/dpkg/updates-old/*

Delete the Package Installer Files

Package installer files are the files that are used by the apt package manager to install the packages.

To delete the package installer files, run:

sudo rm -rf /var/lib/dpkg/info-old/*

Delete the Package Installer Files

Package installer files are the files that are used by the apt package manager to install the packages.

To delete the package installer files, run:

sudo rm -rf /var/lib/dpkg/info/*