Skip to content

Instantly share code, notes, and snippets.

@ksexton
Created March 16, 2017 19:44
Show Gist options
  • Save ksexton/1a1a7820e2433fb334773850673507fa to your computer and use it in GitHub Desktop.
Save ksexton/1a1a7820e2433fb334773850673507fa to your computer and use it in GitHub Desktop.
cleanup centos
yum -y update && \
yum -y install yum-utils && \
service rsyslog stop && \
service auditd stop && \
package-cleanup --oldkernels -y –count=1 && \
yum clean all && \
logrotate -f /etc/logrotate.conf
rm -f /var/log/*-???????? /var/log/*.gz
rm -f /var/log/dmesg.old
rm -rf /var/log/anaconda
cat /dev/null > /var/log/audit/audit.log
cat /dev/null > /var/log/wtmp
cat /dev/null > /var/log/lastlog
cat /dev/null > /var/log/grubby
rm -f /etc/udev/rules.d/70*
sed -i".bak" '/UUID/d' /etc/sysconfig/network-scripts/ifcfg-ens192
rm -f /etc/ssh/*key*
rm -f ~root/.bash_history
unset HISTFILE
history -c
sys-unconfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment