Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124

Cleaning up your Ubuntu system regularly is essential to maintain performance and free up valuable disk space. One effective method is to remove unused packages in Ubuntu. These packages, along with old dependencies and cached files, can accumulate over time, slowing your system. In this guide, we’ll cover nine practical ways to declutter your Ubuntu installation.
aptUbuntu stores downloaded packages in a cache, which can grow large over time. To remove all cached package files, run:
sudo apt clean
This simple command frees up space without affecting installed programs. For more info on package management, check the official Ubuntu documentation.
Logs are crucial for monitoring your system, but outdated logs occupy unnecessary space. Remove logs older than 7 days using:
sudo journalctl --vacuum-time=7d
Or limit total log size to 100 MB:
sudo journalctl --vacuum-size=100M
Regular log maintenance keeps your system lean and responsive. Its best to setup a corn job to clean the logs weekly.
Ubuntu retains old Linux kernels after updates. To identify your current kernel:
uname -r
Then safely remove older kernels:
sudo apt --purge remove linux-image-<version>
Removing outdated kernels prevents storage bloat.
dpkg to Remove Specific PackagesTo delete a package while keeping configuration files:
sudo dpkg --remove <package_name>
For a complete removal, including configs:
sudo dpkg --purge <package_name>
This method is handy when you know specific packages you no longer need.
Snap packages are self-contained but can occupy a lot of space. List installed snaps:
snap list
Remove unnecessary snaps:
sudo snap remove <snap_name>
This is particularly useful for freeing disk space on modern Ubuntu installations.
When packages are uninstalled, leftover dependencies may remain. Clean them with:
sudo apt autoremove
This command removes unnecessary dependencies, ensuring your system stays clean.
To delete old versions of packages from the cache, run:
sudo apt autoclean
This targets outdated files without touching current installations, freeing up storage efficiently.
BleachBit offers a graphical and terminal interface for cleaning caches, temporary files, and logs. Install it using:
sudo apt install bleachbit
After installation, you can run BleachBit from the terminal with root privileges to perform a deep system cleanup:
sudo bleachbit
This tool simplifies bulk system cleanup, but caution is advised since it can remove files you may still need. Run BleachBit as needed for a thorough system cleanup.
Orphaned packages are installed dependencies no longer required by any software. Identify and remove them. To do so we need to first install `deborphan`
sudo apt install deborphan
Then, run the command to list orphaned packages:
deborphan
To remove these orphaned packages, use:
sudo apt-get remove --purge $(deborphan)
This cleans up packages that were once used by other applications but are no longer required.
Regularly implementing these nine steps ensures your Ubuntu system remains optimized. Cleaning unused packages, old logs, caches, and unnecessary kernels not only boosts performance but also secures your system against clutter-related issues. For advanced Ubuntu maintenance tips, visit Ubuntu’s official optimization guide.