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.
2 Answers
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.

- 299,756
-
1
-
Yeah. I deleted log files and it return same size. Again I deleted those files using same method I used before. But now there's an error when power on my laptop . Error : file '/boot/grub/i386-pc/normal.mod' not found – Nisha Apr 26 '19 at 05:55
-
1see https://askubuntu.com/questions/266429/error-file-grub-i386-pc-normal-mod-not-found – Rinzwind Apr 26 '19 at 06:55
You can empty the files by this command on the terminal
echo "" > a_log_file
Where the a_log_file
is file of the big files in /var/log
. But you can get more space on your system by those commands:
sudo apt autoremove
this command help you remove unused packages/dependencies for your apps and system. And this command:
sudo apt autoclean
which autoclean clears out the local repository of retrieved package files. The difference is that it only removes package files that can no longer be downloaded, and are largely useless. This allows a cache to be maintained over a long period without it growing out of control. The configuration option APT::Clean-Installed
will prevent installed packages from being erased if it is set to off.

- 149
/var/log
files but I'm wondering why is that folder so big?. Cheers, sigfried. – Rubén S. García Apr 25 '19 at 14:34$ sudo journalctl --vacuum-size=200M
$ sudo -H emacs /etc/systemd/journald.conf (and set #SystemMaxUse=200M)
Source
: https://ubuntuhandbook.org/index.php/2020/12/clear-systemd-journal-logs-ubuntu/ – stafusa Jun 22 '21 at 16:38