Nullifying a log file in Linux

At this point, you already have the file which is causing the problem and you want to nullify it so just do as;

#cat <logfile.Name> | gzip -v9 > (logfile).(date-time)
# cat lastlog | gzip -v9 > lastlog.300721-0648
#cat /dev/null > lastlog

or

# cp /var/adm/syslog/syslog.log /var/adm/syslog/syslog.log.bak
# gzip /var/adm/syslog/syslog.log.bak
# cp /dev/null /var/adm/syslog/syslog.log
#cat file1 file2 | gzip > foo.gz

Then you can compress the file;

gzip -v9 <file_name>

Alternate way;

du -sk /var/* | sort -n
du -xam /PARTITION | sort -n | tail -n 40
du -xam / | sort -n | tail -n 40

Leave a Reply

Your email address will not be published. Required fields are marked *