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

  • 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

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

| improve this answer | |
  • 1
    No need in this case to use sudo.. – doug Sep 22 '18 at 21:50

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/* 
| improve this answer | |
  • 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

Not the answer you're looking for? Browse other questions tagged or ask your own question.