5

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.

1
  • 2
    Quick answer, yes, you can delete your /var/log files but I'm wondering why is that folder so big?. Cheers, sigfried. – sigfried Apr 25 '19 at 14:34
6

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.

3
  • 1
    > logfile .... also works – Scott Stensland Apr 26 '19 at 2:02
  • 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 5:55
  • 1
    see askubuntu.com/questions/266429/… – Rinzwind Apr 26 '19 at 6:55
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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