Ubuntu – delete /var/log files because of low root space in Ubuntu

disk-usagelog

Is it possible to have 64.5GB log files in Ubuntu? Can I delete those files? My laptop is dual booted and the Ubuntu partition is only 100GB.

Best Answer

Can I delete those files ?

Yes, but do not. EMPTY them instead of deleting. Deleting files from /var/log/ requires the file to be unused and most log files are open. In theory deleting the file might crash the service that uses this log. Not a big issue unless you are hosting something that can not have downtime.

You can empty it with:

echo "" > logfile

Another note: please do not empty them without at least examining why these exists. Those logs will return and return and return. Fixing the issue that is being logged will keep those logs small.