How to Clean Your Ubuntu Machine
4 ways to clean your ubuntu machine. Here are some ways to clean your ubuntu PC and make it faster. Try the examples yourself and see the results.
In general, Linux-based operating systems, like Ubuntu, manage computer resources quite well. However, sometimes users install many programs and don’t uninstall them afterwards, which leads to reduced memory and fragmented disk. As a result, the operating system may slow down. To avoid this, start disk cleaning and enhance the computer’s performance.
Before presenting some ways of cleaning your Ubuntu, let’s see how you can check free space in your system.
Check free space
The first thing you need is to find out which files are consuming the large bulk of the storage space in your disk. Use the Disk Usage Analyzer tool. Run the tool, and you will see the used and free space. After that, you can clear your system.
## Uninstall unnecessary applications
Probably you have many applications that you don’t use any more. Uninstall the application with the following command:
Uninstall the application with the following command
sudo apt remove [application name..]..Or, if you want to do the same without a command line, use the Ubuntu Software manager, where you’ll only need to click the "Remove" button.
Clean unnecessary packages and dependencies
Updating your system via the default updating tool can lead to the accumulation of packages that will fill the cache. This can mainly occur when you uninstall software packages, but their dependencies are left without any reason at all.
To remove the dependencies left behind once installed packages that aren’t needed any longer, use this command:
the command to remove the dependencies left behind once installed packages that aren’t needed any longer
sudo apt-get autoremoveClean the thumbnail cache
There are thumbnails used by Ubuntu to make some operations on your computer to perform them faster. They are like cookies and cache in browsers.
The thumbnails increase over time, and the computer does not clear them automatically. Instead, Ubuntu has a command to clear them.
- Check the size of the thumbnails of your system before deleting them:
the command of checking the size of the thumbnails
du -sh ~/.cache/thumbnails- Run the following command to delete this cache:
the command for deleting thumbnails cache
sudo rm -rf ~/.cache/thumbnails/*Clean the Apt cache
APT (Advanced Package Tool) cache is the place where all the downloaded, installed, and uninstalled files of your system are kept. Ubuntu keeps them in your /var/cache/apt/archives directory.
- Check the size of the APT cache on your system:
changed by command
sudo du -sh /var/cache/apt- Clear this cache entirely with this command:
changed by command
sudo apt-get cleanOr, you can also clean up only absolutely not necessary packages that can’t be found in the repositories any more, or they have new versions located:
changed by command
sudo apt-get autocleanRemove orphaned package
Besides the dependencies files, packages can also become orphaned when you uninstall an application. To get rid of orphan files, you can use"deborphan" package which can be installed and used by the following command:
changed by command
sudo apt-get install deborphan
sudo deborphan --all-packagesRemove unnecessary kernels
If old kernel versions remain on your disk (which can depend on how your system is set up), you can try the following command:
changed by command
sudo dpkg --list 'linux-image*'Remove locale files
Unless you need to switch to several locales all the time, you can uninstall the unused ones and free up some storage space in your system.
You can either install the localepurge package or use the following command:
changed by command
sudo apt-get install localepurge
Once the installation is done, it will remove all locale files from your system that you have no need for.