47
rated 0 times
[
47]
[
0]
/ answers: 1 / hits: 61458
/ 1 Year ago, sun, march 19, 2023, 11:30:00
can anybody give me a solution to truncate all logfile in /var/log/
directory?
and a question just for knowledge, is it a good idea or not?
#!/bin/bash
LOGDIR="/var/log"
for logfile in $(ls $LOGDIR/*log)
do
truncate -s 0 $logfile
done
More From » command-line