Skip to content

Instantly share code, notes, and snippets.

@jehadja
Forked from ET-CS/clear_log.sh
Created August 17, 2017 13:09
Show Gist options
  • Save jehadja/53cb3870ee573573d2c7f7489bfaaa1e to your computer and use it in GitHub Desktop.
Save jehadja/53cb3870ee573573d2c7f7489bfaaa1e to your computer and use it in GitHub Desktop.
Linux (CentOS) clear log script
#!/bin/bash
# this script clear logs in Linux (made in CentOS)
cd /var/log
truncate -s 0 /var/log/*log
find . -name "*.gz" -type f -delete
find . -name "*.0" -type f -delete
find . -name "*.1" -type f -delete
find . -name "*.log.*" -type f -delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment