Created
January 6, 2018 23:51
-
-
Save thedava/7714d721112326034b395ba2c95bcfcc to your computer and use it in GitHub Desktop.
Linux system cleaning
This file contains hidden or 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 | |
# Check for root | |
if [[ "$(id -u)" != "0" ]]; then | |
echo "This script must be run as root" 1>&2 | |
exit 1 | |
fi | |
# Remove old kernels | |
apt autoremove | |
# Remove old and unused packages | |
apt-get autoremove | |
# Clear package cache | |
apt-get clean | |
# Remove old package lists | |
rm -rf /var/lib/apt/lists/* | |
apt-get update | |
# Remove offline documentations | |
#apt-get remove *-doc | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment