Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5145

Beginners • Re: Hekp needed with a shell sript

$
0
0
i use find
for example in my .bash_aliases to clean logs

Code:

sudo find /var/log -name '*.log.*' -exec rm {} \;
Nice idea but it won't match every log file as some don't have ".log." in their name.

@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 is

Code:

man find
sorry, i just target the log.#, log.gz, log.old, etc....
i have a different 1 for journal, apt and so on.
i don't remove everything, just don't want them to keep growing.
:lol:

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



Viewing all articles
Browse latest Browse all 5145

Trending Articles