/var/log is the disk's memento mori. Servers run for years, log rotation gets misconfigured, and one day a 4 KB write fails because some *.log.42.gz from 2023 is hogging an inode. Cleaning it up is conceptually trivial and operationally fraught: one wrong glob and you've removed something you wanted.
Start with a survey, not a delete
Always look first. CliAI doesn't auto-delete, but it's good practice to ask for the listing before you ask for the rm.
$ clai list .log files older than 30 days under /var/logβ find /var/log -type f -name '*.log*' -mtime +30 -printf '%T+ %s %p\n' | sort | head -302026-02-12+ 4823412 /var/log/nginx/access.log.42.gz2026-02-15+ 1240881 /var/log/syslog.4.gzβ¦
If the list looks right, the next step is the deletion:
$ clai delete log files older than 30 days under /var/logβ find /var/log -type f -name '*.log*' -mtime +30 -delete[Safety: CAUTION] β irreversible. Press Enter to run.
CAUTION, not DANGER, because the path is bounded and the predicate is specific. rm -rf /var/log would be DANGER and would refuse to run without your explicit confirmation.
Backups: keep the last N
A common pattern: keep the seven newest, delete the rest.
$ clai keep the 7 newest .tar.gz backups in /backups, delete the restβ ls -1t /backups/*.tar.gz | tail -n +8 | xargs -r rm -vremoved '/backups/2026-03-15.tar.gz'removed '/backups/2026-03-14.tar.gz'
tail -n +8 is the part nobody remembers. Notice CliAI added xargs -r to avoid running rm with no arguments if the list is empty β a small thing that saves you when the directory is unexpectedly clean.
DANGER demonstration
Just so you've seen it: ask for something genuinely destructive and the panel turns red.
ββ Task βββββββββββββββββββββββββββββββββββββββββββββββββ delete everything in / older than a year βββ Command βββββββββββββββββββββββββββββββββββββββββββββ€β find / -mtime +365 -delete βββ Safety: DANGER ββββββββββββββββββββββββββββββββββββββ€β Crosses filesystem roots. Will hit /etc, /var, /usr. ββ Type "yes" to confirm, anything else cancels. βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
The classifier is regex-based and not infallible β see the safety post for an honest accounting of what it catches and what slips through. Inspecting the command yourself remains the last line of defense.
See also
- Find large files β the typical find before you delete step.
- Kill processes β same family of "I always Google this" tasks.