commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
small update for this command to work with linux kernels 3.x
There is 1 alternative - vote for the best!
This should do the same thing and is about 70 chars shorter.
Note the double space: "...^ii␣␣linux-image-2..."
Like 5813, but fixes two bugs: This leaves the meta-packages 'linux-headers-generic' and 'linux-image-generic' alone so that automatic upgrades work correctly in the future. Kernels newer than the currently running one are left alone (this can happen if you didn't reboot after installing a new kernel).
I'm bummed that this took 228 characters. I'd like to see a simpler version.
This will remove all installed kernels on your debian based install, except the one you're currently using.
Remove old kernels (*-generic and *-generic-pae) via apt-get on debian/ubuntu based systems. Tested on ubuntu 10.04 - 12.04.
A little aptitude magic. Note: this will remove images AND headers. If you just want to remove images: aptitude remove ?and(~i~nlinux-im ?not(~n`uname -r`))
I used this in zsh without any problems. I'm not sure how other shells will interpret some of the special characters used in the aptitude search terms. Use -s to simulate.
If you can do better, submit your command here.
You must be signed in to comment.