Skip to content

Instantly share code, notes, and snippets.

@alsyundawy
Forked from ipbastola/free-system-space.md
Created May 19, 2019 13:48
Show Gist options
  • Save alsyundawy/5d377f5fd99806bee209bc81fb56f042 to your computer and use it in GitHub Desktop.
Save alsyundawy/5d377f5fd99806bee209bc81fb56f042 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