Best Way To Clear Logs (And Get /var/log State Restored)?

I seem to have throughly screwed up my system deleting logs manually.

Is there a Terminal command or script that will clear logs without messing up the permissions and folder structure?

And is there a way to get the /var/log folder state back without reinstalling?

There was a recent post on exactly this, with a solution. Search the
forum.

1 Like

Hi Emily i found this new github page a few days ago that has a log cleaner script for Qubes


#!/bin/bash

sudo journalctl --rotate

sudo journalctl --vacuum-time=1s

#journalctl --rotate

#journalctl --vacuum-time=1s

rm -frv /var/log/qubes/*

sudo rm -frv /var/log/xen/console/*

sudo rm -frv /var/log/libvirt/libxl/

sudo rm -frv /var/lib/logrotate/logrotate.status

#Reboot system after running script mostly due to removing the libxl folder

Please post back any additional tips if you learn anything new

4 Likes