News for hackers. Stuff that matters.
Re:Ask HN: What do you want to see in Ubuntu 17.10? by nyolfen on Friday March 31, 2017 @01:10PM (#14005833)
would you mind sharing this in the meantime?
Re:Ask HN: What do you want to see in Ubuntu 17.10? by tombrossman on Friday March 31, 2017 @01:24PM (#14005986)
I've been using this for years. I believe it only keeps one old kernel version though, not two like you requested. Tested and working for weekly use since 12.04 though 16.04:

echo $(dpkg --list | grep linux-image | awk '{ print $2 }' | sort | sed -n '/'`uname -r`'/q;p') $(dpkg --list | grep linux-headers | awk '{ print $2 }' | sort -n | sed -n '/'"$(uname -r | sed "s/\([0-9.-]*\)-\([^0-9]\+\)/\1/")"'/q;p') | xargs sudo apt-get -y purge

Re:Ask HN: What do you want to see in Ubuntu 17.10? by throwaway6556 on Friday March 31, 2017 @03:13PM (#14007155)
I guarantee there's a way to get that pipe to purge all packages in your system.
Re:Ask HN: What do you want to see in Ubuntu 17.10? by noja on Friday March 31, 2017 @05:22PM (#14008409)
This is the new way to do it:

    sudo purge-old-kernels --keep 3 -qy
TIL