Skip to content

Instantly share code, notes, and snippets.

@GarnetSunset
Created January 18, 2019 21:13
Show Gist options
  • Save GarnetSunset/5025bf08108f9bf719ac38686436c71c to your computer and use it in GitHub Desktop.
Save GarnetSunset/5025bf08108f9bf719ac38686436c71c to your computer and use it in GitHub Desktop.
Cleanup Centos 6 (or whatever you want)
# make sure you have yum-utils
# run me as sudo
find /var -name "*.log" \( \( -size +50M -mtime +7 \) -o -mtime +30 \) -exec truncate {} --size 0 \;
yum clean all
rm -rf /var/cache/yum
rm -rf /var/tmp/yum-*
package-cleanup --quiet --leaves --exclude-bin
package-cleanup --quiet --leaves --exclude-bin | xargs yum remove -y
package-cleanup --oldkernels --count=2
rm -rf /root/.composer/cache
rm -rf /home/*/.composer/cache
find -regex ".*/core\.[0-9]+$" -delete
find /home/*/public_html/ -name error_log -delete
rm -rf /root/.npm /home/*/.npm /root/.node-gyp /home/*/.node-gyp /tmp/npm-*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment