Linux systems aren’t as light on disk space as they could be. For example, the APT package manager keeps package files around even after you install them — a waste of space unless you plan on uninstalling and reinstalling them.
We’ve also covered freeing up disk space on Windows and freeing up disk space on a Mac. Many of the tips are similar — removing temporary files, analyzing your disk usage, and seeing which installed applications use the most space.
Delete Temporary Files
BleachBit is basically a CCleaner for Linux. It will scan your computer for unnecessary temporary files and automatically remove them to free up space. This includes caches, browser histories, and other temporary files. You can install BleachBit from the Ubuntu Software Center.
Note that this tool won’t be able to remove APT packages and other system-wide stuff unless you open it with root privileges. Open a terminal and run the sudo bleachbit command to open it as root. (The gksu command, which we would have recommended previously, has been removed from Ubuntu.)
One of the nicest things about BleachBit is that it automates some things that only experienced Linux users would normally think to do. For example, it runs the autoclean, autoremove, and clean commands for APT — this uninstalls packages you no longer need and removes cached package files that are already installed. You don’t need these downloaded package files — it’s sort of like if Windows kept all the software installers around even after you installed the associated program. In the unlikely even you need to reinstall them, APT can download them again.
Analyze Your Disk Usage
Ubuntu includes a tool that will scan your file system and show a graphical overview of which directories and files are using the most space. This can be a big help when you’re trying to free up space — do you have an old virtual machine or another large file buried somewhere in your home directory? This tool will find it and make it very obvious that it’s taking up a large amount of space.
This tool is installed by default — launch the Disk Usage Analyzer tool to open it. If you’re using another Linux distribution, it may already be installed by default, as it’s part of GNOME — if not, look for the Baobab package.
Find Which Appliations Are Using the Most Space
Your installed applications — in the form of packages — are taking up space on your hard drive, too. If you have quite a few applications installed, they may be taking up quite a bit of space. To determine how much space packages are taking up, we recommend the Synaptic package manager. It was previously a part of Ubuntu, but was removed from the default install to make room for simpler utilities. To install it, open the Ubuntu Software Center and search for Synaptic.
If you use another .deb-based distribution, you’ll probably also have access to Synaptic. If you use a distribution not based on Debian, you’ll probably have to use a different package management utility for this.
To view which packages are using the most space, select Status > Installed in Synaptic to see a list of all your installed packages. Next, click the Size column to view a list of your installed packages by size. (If you don’t see the Size column, click Settings > Preferences and ensure the Size column is enabled on the Columns and Fonts tab. You can also move it to the top of the list and it will appear on the left.)
Of course, just because a package is using up a lot of space doesn’t mean you should uninstall it. Some packages are crucial for system functioning, like the Linux kernel. However, below we an see that LibreOffice, Firefox, and Thunderbird are using up a decent chunk of space between them — if we were really short on space and we never used these applications, we could uninstall them to free up space. We could always reinstall them from the package manager in the future.
Remove Old Kernels
Ubuntu keeps old Linux kernels around even after it installs new versions. You can choose to boot into these old kernels from the boot loader menu that appears when you boot your computer. This is useful if a new Linux kernel breaks something and you have to go back to an old kernel so your system will work properly — but if the latest kernel is working fine, all these old kernels do is take up space.
Important: Before removing any kernel files, ensure that you’ve rebooted after installing the latest kernel update and aren’t currently using an old kernel. Ubuntu will automatically boot into the latest kernel when you start it, but you may still be using an old kernel if you haven’t rebooted in awhile and there was a recent kernel update.
It’s easy to remove old Linux kernels using the Synaptic package manager utility. Press Ctrl+F in Synaptic, tell the search feature to search only the Name field, and search for linux- — yes, with the dash. Sort by installed packages and you’ll see the appropriate packages appear at the top of the list.
Note that we have several different versions for the linux-image-extra, linux-headers, and linux- packages. We can remove old versions of all of these packages — each kernel has multiple different packages associated with it. Just select the old versions, right-click, and mark them for removal. Apply your changes afterwards to free up some space.
Remember — only remove the old versions of the kernel files! Leave the most recent versions alone or your system will become unbootable. For example, in the image below, we want to leave the 3.11.0-18 files alone while removing the 3.11.0-12 and 3.11.0-15 files. According to Synaptic, removing these two kernels and their associated files freed up over 500 MB of space.
If you operate a Linux server, you may also be able to free up some space by purging or shrinking large log files. If an application is generating large log files you don’t need, you may be able to change its options so that it logs only the most important events to the files, saving disk space.
Image Credit: Jason Mann on Flickr
- › What Is Fedora Linux?
- › How to Zip and Unzip Files With Gzip on Linux
- › How to Find and Remove Duplicate Files on Linux
- › “Atari Was Very, Very Hard” Nolan Bushnell on Atari, 50 Years Later
- › What’s New in Windows 11’s 22H2 Update: Top 10 New Features
- › The 10 Best Netflix Original Movies in 2022
- › A World Without Wires: 25 Years of Wi-Fi
- › T-Mobile Is Selling Your App Activity: Here’s How to Opt Out