What the video covers
Commands for package cleanup using apt and optional deborphan; safe for general desktop/server Ubuntu systems. Does not cover distribution-specific package managers or automated GUI tools.
Watch the video on YouTubeStep-by-step instructions
- Open a terminal
Use your desktop's terminal app or connect via SSH for remote systems. - Update package lists
Run: sudo apt update — this ensures apt knows the latest package state before removing anything. - Remove unused dependencies
Run: sudo apt autoremove — this removes packages that were installed as dependencies but are no longer required. - Clean cached package files
Run: sudo apt clean — this deletes downloaded package files stored in the apt cache to free disk space. - Remove partially installed or obsolete package files
Run: sudo apt autoclean — this removes cached package files that can no longer be downloaded (obsolete). - Manually remove or purge specific packages
To remove a package: sudo apt remove package-name. To also remove configuration files: sudo apt purge package-name. Use apt list –installed to confirm package names before removal. - Optional: find orphaned libraries with deborphan
For deeper cleanup, install deborphan (sudo apt install deborphan), run deborphan to list orphaned libs, and carefully remove any you don't need (sudo apt remove package-name). This step is for advanced users—review results before removing. - Optional: clear thumbnail cache
To free user cache space, remove thumbnail files: rm -rf ~/.cache/thumbnails/* (this affects only user thumbnails).
Watch the video
Play tutorial
Why it matters
Leftover dependencies, cached packages, and unused libraries accumulate over time and consume disk space. Regular cleanup recovers storage and can reduce background resource use, improving stability.
Check your result
After running the steps, confirm reclaimed space with df -h and review installed packages with apt list –installed. Reboot if you removed low-level libraries that may require a restart.
Troubleshooting
If a removal fails due to broken packages, run sudo apt –fix-broken install and then retry autoremove/clean. If a needed package was removed accidentally, reinstall it with sudo apt install package-name.