Skip to content

Instantly share code, notes, and snippets.

@thedava
Created January 6, 2018 23:51
Show Gist options
  • Save thedava/7714d721112326034b395ba2c95bcfcc to your computer and use it in GitHub Desktop.
Save thedava/7714d721112326034b395ba2c95bcfcc to your computer and use it in GitHub Desktop.
Linux system cleaning
#!/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