Skip to content

Instantly share code, notes, and snippets.

@jewei
Last active October 22, 2019 06:25
Show Gist options
  • Save jewei/f22c752bb480f8cf06bbe6984dbf3bfa to your computer and use it in GitHub Desktop.
Save jewei/f22c752bb480f8cf06bbe6984dbf3bfa to your computer and use it in GitHub Desktop.
// Clear or truncate log files
truncate -s 0 /var/log/*.log
truncate -s 0 /var/log/**/*.log
find /var/log -type f -name '*.log' -exec truncate -s 0 {} +
find /var/log -type f -iname '*.log' -print0 | xargs -0 truncate -s0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment