Skip to content

Instantly share code, notes, and snippets.

@soundyogi
Forked from jdowning/ami-clean.sh
Last active June 10, 2019 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soundyogi/ee05c1e17f17a4e3b6a03c01c63dc734 to your computer and use it in GitHub Desktop.
Save soundyogi/ee05c1e17f17a4e3b6a03c01c63dc734 to your computer and use it in GitHub Desktop.
Script to clean up Ubuntu
#!/bin/bash
function print_green {
echo -e "\e[32m${1}\e[0m"
}
print_green 'Start'
print_green 'Cleanup log files'
find /var/log -type f | while read f; do echo -ne '' > $f; done
print_green 'Cleanup bash history'
unset HISTFILE
[ -f /root/.bash_history ] && rm /root/.bash_history
[ -f /home/ubuntu/.bash_history ] && rm /home/ubuntu/.bash_history
print_green 'Cleanup complete!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment