A terminal-based cache and log cleaner for Linux. Pure bash, no dependencies, installs in one command.
- 14 cleaning targets — package caches, logs, browser data, Docker, and more
- Dry-run mode — preview exactly what would be deleted before committing
- Scan mode — disk usage dashboard for all targets, no cleaning
- Age filtering — only remove files older than N days
- Exclusions — run
--allbut skip specific targets - Quiet mode — silent output for cron/scripting
- Run log — every run is recorded to
/var/log/cleanit.log - Built-in scheduler — install/remove a weekly cron job in one command
tar -xzf cleanit.tar.gz
cd cleanit
sudo bash install.shThis copies cleanit to /usr/local/bin so it's available system-wide.
cleanit --scan # see what's taking up space first
cleanit --dry-run --all # preview everything, no changes
sudo cleanit --all # clean everything
sudo cleanit --logs --journal --varlog # target only logs
cleanit --pip --npm --yarn # dev caches, no root needed
sudo cleanit --all --exclude docker # everything except docker
sudo cleanit --apt --logs --older-than 14 # only touch files >14 days old| Flag | What it cleans | Root |
|---|---|---|
--apt |
APT package cache + autoremove | yes |
--snap |
Disabled snap revisions | yes |
--flatpak |
Unused Flatpak runtimes | no |
--pip |
pip3 cache | no |
--npm |
npm cache | no |
--yarn |
yarn cache | no |
--cargo |
Cargo registry & git cache | no |
--docker |
Stopped containers, dangling images, unused volumes | yes |
--browser |
Chrome, Chromium, Firefox, Brave, Vivaldi, Opera caches | no |
--thumbnails |
GNOME/KDE thumbnail cache | no |
--trash |
User trash | no |
--journal |
systemd journal (keeps last 7 days / 200 MB) | yes |
--varlog |
Rotated logs in /var/log (.gz, .1, .old) |
yes |
--logs |
Active system logs, app logs (nginx/apache/mysql), user logs | yes |
--tmp |
Stale files in /tmp not accessed in 3+ days |
no |
Use --all to run every target at once.
-h, --help Show help
-v, --version Show version
-n, --dry-run Preview only — no files deleted
-V, --verbose Show each command as it runs
-f, --force Skip all confirmation prompts
-q, --quiet Suppress output (errors + final total only)
--scan Show disk usage of all targets, no cleaning
--older-than N Only remove files older than N days
--exclude t1,t2 Skip these targets even with --all
--schedule Install a weekly cron job (root)
--unschedule Remove the weekly cron job (root)
--last Print the last run summary from the log
Cleans logs in three layers:
- Active system logs — truncates (zeroes, doesn't delete)
/var/log/syslog,auth.log,kern.log,daemon.log, etc. Running services keep their file handles open; only the content is cleared. - App logs — prompts before clearing logs in
/var/log/nginx,/var/log/apache2,/var/log/mysql,/var/log/postgresqlif present. - User logs — removes
*.logfiles under~/.cacheand~/.local/share, and clears~/.local/share/recently-used.xbel.
Pair with --journal and --varlog for a full log wipe:
sudo cleanit --journal --varlog --logsThe built-in scheduler drops a script into /etc/cron.weekly:
sudo cleanit --schedule # install — runs every week automatically
sudo cleanit --unschedule # removeOr add your own crontab entry for more control:
0 3 * * 0 root /usr/local/bin/cleanit --all -f -q >> /var/log/cleanit.log 2>&1
Every execution appends a timestamped entry to /var/log/cleanit.log:
[2026-05-15 03:00:01] cleanit v1.0.0 run
apt: 340.00 MB freed
journal: 1.20 GB → 45.00 MB
logs: active system + app + user logs cleaned
total freed: 1.52 GB
View the last run anytime:
cleanit --lastsudo bash uninstall.shRequires bash 4.0+. Tested on Ubuntu 22.04+, Debian 12+, and Arch Linux. Works on any systemd-based distro. Non-installed tools (snap, docker, flatpak, etc.) are detected and skipped automatically.