SPRING-CLEAN YOUR INSTALLATION
While a rolling stone gathers no moss, the more you use your distro the more files it’ll accumulate. Over time these unnecessary files clog up your partitions and slow down disk operations. The first thing you need to do is find out which files are consuming the bulk of the storage space on your hard disk. Most Gnome-based distros, including Ubuntu, bundle the Disk Usage Analyser app that will help you visualise the contents of your disk.
Launch the app and select the partition you want analysed. Depending on the size of the partition and the number of files, it might take some time to draw up a visual map of your disk. Once you have determined the files that are taking up a lot of storage space, you can either back them up to an external drive or permanently delete the ones you don’t need.
Under new management
If you diligently keep your distro updated, chances are you’ve also accumulated a stack of older kernels that you no longer need. These are kept in case you are unable to boot into your distro with the updated kernel. You can remove old kernels with a simple autoremove command in a terminal: sudo apt-get autoremove --purge
If you are using Fedora, the easiest way to remove old kernels automatically is to set the kernel limit in the /etc/dnf/dnf.conf file, such as: installonly_limit=2 #keep only last 2 kernels
Save and close the file, and update the installation with dnf upgrade --refresh , which will remove all older kernels except the two most recent ones.
As you know, the installation of some packages depends on others packages or libraries in order to work. Ubuntu’s autoremove option will also remove the libraries that are usually left behind after you’ve uninstalled the parent app.
In addition, use sudo apt clean all to clean the apt cache on Ubuntu, and sudo dnf clean all for the same purpose under Fedora. A good practice to avoid any leftover packages and libraries is to use the autoremove option whenever you want to uninstall an application, such as:
sudo apt autoremove
Jump start
Usually autoremove will remove any orphaned packages, but it won’t catch them if you installed the dependencies manually. Deborphan is the command line tool that allows you to see orphaned packages in your Linux system. Head to the terminal and install the utility with sudo apt install deborphan . Use the deborphan command to list the orphaned packages. To remove all the orphaned packages, use sudo apt remove --purge `deborphan` .
Talking of improvements to apt, use the apt-fast wrapper to fetch packages faster via simultaneous downloads from multiple connections. First add its PPA with sudo add-apt-repository ppa:apt-fast/stable , then update the repositories with sudo apt update before installing the script with sudo apt install apt-fast .
One of the major causes of longer boot times is that your system starts unnecessary apps and services during startup. Ubuntu ships with the Startup
Applications tool that lets you add and remove any apps that you’d like the distro to launch when it boots up. However, it doesn’t show the complete list of startup apps and services. To display them, run the following: sudo sed -i ‘s/nodisplay=true/nodisplay=false/g’ /etc/ xdg/autostart/*.desktop
Now launch Startup Application and disable any application by unticking its box. Make sure you read through their descriptions and disable any you don’t require (rather than using the Remove option).