Ubuntu server upgrade

# Get list of available upgrades
sudo apt-get update

# Upgrade packages
sudo apt-get upgrade

# Upgrade distro
sudo apt-get dist-upgrade

Remove old kernels

# Reboot into newest first, of course
sudo shutdown -r now

# Remove all old kernels
sudo apt-get remove --purge $(dpkg -l 'linux-image-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d')