-
-
Save jdevera/06c396b7d6a988f145e1c40c0bd96a06 to your computer and use it in GitHub Desktop.
VM Clean Up (cleaning up Debian based system for use as template)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Clean up Apt | |
apt-get autoremove | |
apt-get autoclean | |
apt-get clean | |
# Generate new SSH host keys | |
for T in dsa rsa ecdsa; do | |
echo -e 'y\n'|ssh-keygen -t $T -N "" -f /etc/ssh/ssh_host_${T}_key | |
done | |
# Remove everything in the /tmp directory: | |
rm -rvf /tmp/* | |
rm -rvf /var/tmp/* | |
# Clean up logs | |
rm -vf /var/log/wtmp /var/log/btmp | |
rm -vf /var/log/*.log.* | |
rm -vf /var/log/*/* | |
# Clean up the command history: | |
history -c | |
# Almost done but we don't want to leave the last commands in the history either | |
unset HISTFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment