\chapter{Linux}

\section{Kernel Upgrades}

\begin{txt}
    # LIST KERNELS ON /boot PARTITION
    
    dpkg --list | grep linux-image
    dpkg --list | grep linux-headers
\end{txt}

\begin{txt}    
    # REMOVE SELECTED KERNEL VERSIONS FROM BOOT PARTITION
    
    sudo apt-get purge linux-image-4.4.0-{75,78,79}
    sudo apt-get purge linux-image-extra-4.4.0-{75,78,79}
    sudo apt-get purge linux-headers-4.4.0-{75,78,79}
    
    or
    
    sudo apt autoremove [-f]
\end{txt}
    
\begin{txt}
    # My one-liner to remove old kernels (this also frees up disk space)
    # https://askubuntu.com/a/254585
    
    dpkg --list | grep linux-image | awk '{ print \$2 }' | sort -V | sed -n '/'`uname -r`'/q;p' | xargs sudo apt-get -y purge
\end{txt}
    
\begin{txt}    
    # Remember to update grub2 configuration
    sudo update-grub2
\end{txt}