All-safe (batch)
--all-safe cleans every regenerable cache in a single pass. It is the mode for unattended maintenance
and the only mode --yes applies to.
linux-cleanup --all-safe # one confirmation for the batch
linux-cleanup --all-safe -y # no prompts — the cron form
What "safe" means here
Safe means regenerable: package-manager caches, browser and application caches, and stale developer-tool data. It does not mean risk-free, and it does not mean reversible — deletions are still permanent.
What --all-safe will never touch, regardless of --yes:
- Personal files in
~/Downloads,~/Desktopor anywhere else - Partial downloads
node_modulesdirectories- Anything on the protected-path list
- Globally installed packages or shell-init files
Those categories are interactive-only by design
and are simply not part of this mode. This is what makes --all-safe -y acceptable in a cron job.
Since 1.1.0 the mode also runs a startup assertion that aborts with a BUG: message if any protected
runtime directory ever leaks into its target list, so a future regression fails loudly rather than deleting
something it should not.
--yes and its limits
-y / --yes auto-confirms cache deletions. It is only valid with --all-safe; the interactive modes
ignore it by policy.
linux-cleanup --all-safe -y
-y means you will not see the decisions until afterwardsThe allowlist and staleness gate still apply, but you review the log after the run. A standalone all-safe
run does not write the walkthrough's JSON session report. For a first run, inspect a
--scan and an --all-safe --dry-run first.
Pruning, and what survives
By default --all-safe prunes eligible cache files whose atime and mtime are both older than --days
(default 100). Extracted packages and versioned tools are handled as whole units under their own idle rules.
The human output reports selected results; use the dry run to inspect proposed paths before deletion.
linux-cleanup --all-safe -y # 100-day threshold
linux-cleanup --all-safe -y -d 30 # more aggressive
linux-cleanup --all-safe -y --purge-all # gate off — full wipe
--purge-all in a cron job is a poor combinationUnattended plus no staleness gate means a Gradle wrapper distribution or Playwright browser bundle can
disappear the week before you need it, with nobody watching. Keep --purge-all for deliberate,
before-reimaging runs.
Running it weekly
linux-cleanup --install-cron
This schedules --all-safe -y for Sundays at 03:00 and appends output to ~/.linux-cleanup/logs/cron.log.
See Alias and cron for the exact entry and how to remove it.
If you write the crontab entry yourself, use an absolute path — cron's minimal PATH will not find a
~/.local/bin install:
0 3 * * 0 /usr/local/bin/linux-cleanup --all-safe -y --no-report --cleanup-logs >>~/.linux-cleanup/logs/cron.log 2>&1
--cleanup-logs removes that run's log. Standalone all-safe runs do not write the walkthrough's JSON session record, so --no-report has no further effect here.
Checking what a cron run did
tail -100 ~/.linux-cleanup/logs/cron.log
If the cron log shows command not found, the crontab is using a bare command name — see
Troubleshooting.
When to use something else
| Situation | Better mode |
|---|---|
| First time on this machine | --scan, then --all-safe --dry-run |
| You want to see each decision | Walkthrough |
| Only one category needs cleaning | Menu or TUI |
| You want to reclaim personal files too | Stale personal files, interactively |
Next
- Alias and cron — scheduling it
- Reclaim the most space — the aggressive path
- Safety guards — what still applies under
-y