sorry, i just target the log.#, log.gz, log.old, etc....Nice idea but it won't match every log file as some don't have ".log." in their name.i use find
for example in my .bash_aliases to clean logsCode:
sudo find /var/log -name '*.log.*' -exec rm {} \;
@OP:
This is another vote for find. But as with everything, test, test, and test again before running it in anger. find is very powerful and can easily trash your system.
For best results read and understand the docs. Quickest way tog et them isCode:
man find
i have a different 1 for journal, apt and so on.
i don't remove everything, just don't want them to keep growing.

Statistics: Posted by kerry_s — Fri Mar 15, 2024 1:51 am