Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Free System space from massive log files

Free System Space from Massive Logs

  1. Remove compressed log files from /var/log
$ sudo find /var/log -type f -name "*.gz" -delete
  1. Truncate Log files
$ cd /var/log

$ sudo truncate -s 0 mail.log
$ sudo truncate -s 0 mail.log.1

$ sudo truncate -s 0 syslog
$ sudo truncate -s 0 syslog.1
  1. Truncate Nginx error/access logs
$ cd to_nginx_log_dir
$ sudo truncate -s 0 error.log access.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment