Skip to content

Instantly share code, notes, and snippets.

@ipbastola
Last active May 19, 2019 13:48
Show Gist options
  • Save ipbastola/becb100817a211d8a245544f80887b7d to your computer and use it in GitHub Desktop.
Save ipbastola/becb100817a211d8a245544f80887b7d to your computer and use it in GitHub Desktop.
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