As we all know Linux and distributions can be installed and used smoothly on as low as 20GB of disk space.
But with time disk space is something that is never abundant.
Unlike Windows, Linux and its distros don't come with tools like defragmenter hence after sometime Ubuntu gets slower due to unnecessary files and applications taking up space on the disk.
So, to keep the Ubuntu system steady and fast you need to get rid of unneeded trash at regular intervals.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform Linux related queries.
In this context, we shall look into methods to free up the disk space in Ubuntu and be never short on disk space.
This tasks can be completed via GUI as well as from the command-line.
Every time we install any application or package using Terminal, APT creates and keeps a cache of the previously downloaded and installed app or package on the disk. The cache of these apps and packages stays on disk even after they are uninstalled from the system.
APT also known as Advance Package Tool is used by Ubuntu to install, uninstall, and manage applications on the system. Generally, a cache of DEB packages is stored in the location /var/cache/apt/archives.
To know the exact size of the cache, run the following command in Terminal.
$ sudo du -sh /var/cache/apt
Now you have two options to remove the APT cache, either to remove only outdated packages or remove all of them.
Remove only outdated packages:
$ sudo apt-get autoclean
Remove all packages
$ sudo apt-get clean
Stacer is an open-source system optimizer that helps you keep track of your system’s performance. It is a modern tool with a modern user interface which makes it attractive and easy to use.
It is a feature-rich tool and you can also clean up disk space using its dedicated feature.
You can remove old kernels from your system which are no longer required. But you have to do this step with caution because it may damage the system.
Old kernels can leave huge junk of files on the disk and slow down the Ubuntu system. Use the following command to remove the old Kernels from the system.
Before removing the older kernel, you must check the installed Linux kernel versions on your system.
To do this run the following command in Terminal.
$ sudo dpkg --list ‘linux-image*’
Now you can remove the older version using the following command.
$ sudo apt-get remove linux-image-version
Or simply you can run the following command to remove old kernels.
$ sudo apt-get autoremove --purge
Everyone has some applications on their system they hardly use and these applications only there to eat some space on disk which can be used for better purposes.
So, head over to Ubuntu Software Centre and then click on Installed. Here you will see the list of apps and games installed on your system.
You can uninstall the apps or games you don't use or need and free up some space on your disk.
From the smartphone OS to the desktop OS I use, I like to keep them up to date.
As soon as updates get released, I update my system. It helps me keep my system smooth and fresh.
Not many recommend this but it is worth it. Some updates also bring fixes that stop apps and packages from occupying too much of disk space.
So, it is always a good idea to keep your system up to date.
This article covers different effective ways to free up some disk space on your Ubuntu system or other Linux distro.
Although Linux does not clutter up like Windows, it may be useful to occasionally clean up Linux. Especially in systems with a smaller hard drive it can be beneficial to clean Linux. Occasionally cleaning up Linux does have to be done on a daily basis or weekly basis, 1 time per month is more than sufficient.
Terminal commands to free up some disk space on your Linux System:
There are 3 terminal commands which you can use top clean up Linux Mint.
Each terminal will be explained about what they do and remove.
All three commands contribute to free up disk space.
1. sudo apt-get autoclean
This terminal command deletes all .deb files from /var/cache/apt/archives. It basically cleans up the apt-get cache.
2. sudo apt-get clean
This terminal command is used to free up the disk space by cleaning up downloaded .deb files from the local repository.
3. sudo apt-get autoremove
This terminal command used to remove packages that were automatically installed to satisfy dependencies for some package and no longer needed by those packages.