1

I want to delete var/log files due to low disk space, but I cannot find out how.

Hass
  • 11
  • 1
    If you rm the log files, you may temporarily solve your low disk space issue, but you do realize the log files will be re-created & return... If you have a condition causing these to grow too large, you should be treating the cause, and not its effect (esp. in this way). – guiverc Sep 22 '18 at 22:43

2 Answers2

2

As mentioned, you can delete a specific log file with sudo rm /var/log/<FILENAME> or all of them with sudo rm /var/log/*.

I also found this: du -h /var/log/ 2>/dev/null > ~/fileinfo to list the size and path of every log file. To view the result you can use cat ~/fileinfo

Jeremi G
  • 121
0

1. Open up the terminal

2a. If you are not sure that you want to delete all of the files you can do it one by one

sudo rm /var/log/logfile.log 

2b. or all of them at once

sudo rm /var/log/* 
abu_bua
  • 10,783
m_krsic
  • 549
  • 1
    I would also try to see which file is the biggest and look at the log to see what warning or error is filling up the log and then try to correct it. – chili555 Sep 22 '18 at 20:41