Clean up unnecessary files and free up disk space on Linux (Ubuntu/Debian).
Before you start: This script removes files. Always review what it will do first using
--dry-run, and keep backups just in case.
- Installer cache – old packages you don't need anymore
- System logs – takes up space over time
- Temporary caches – browser cache, thumbnails, app temp files
- Unused apps – old versions from Snap
- Your trash bin – permanently empties it
- Developer caches – pip and npm if you code
- Docker junk – unused containers, images, volumes
You get a report before and after showing how much space you freed up.
- Ubuntu, Debian, or similar Linux (APT-based)
- sudo access (to remove system stuff)
git clone https://github.com/opbot-xd/linux-junk-cleaner.git
cd linux-junk-cleaner
chmod +x linux-cleanup.sh
./linux-cleanup.sh --dry-runFirst time? Start here:
./linux-cleanup.sh --dry-run # See what it will clean, don't actually do itReady to clean?
./linux-cleanup.sh # Interactive: review each step and confirmJust do it all (if you trust me):
./linux-cleanup.sh --all # Run everything automaticallySkip something you don't want cleaned:
./linux-cleanup.sh --no-trash --no-snap # Skip trash and Snap cleanup- Installer cache – leftover
.debfiles - Unused packages – stuff you installed but don't use anymore
- System logs – keep the recent ones, trim the old ones
- Old app versions – remove disabled Snap revisions
- Your cache – browser cache, app temp files, thumbnails
- Your trash – permanently empties it
⚠️ - Developer caches – pip (Python) and npm (Node.js) if installed
- Docker junk – unused containers, images, volumes, and networks
- See
USAGE.mdfor all the flags and options - Check
warning.mdif you're worried about safety - Want to add a new cleanup step? See
CONTRIBUTING.md
Licensed under MIT (free to use and modify).