The following packages will be REMOVED: linux-headers-2.6.32-24 linux-headers-2.6.32-24-generic linux-headers-2.6.32-25 linux-headers-2.6.32-25-generic linux-headers-2.6.35-22 linux-headers-2.6.35-22-generic linux-image-2.6.32-24-generic linux-image-2.6.32-25-generic linux-image-2.6.35-22-generic 0 packages upgraded, 0 newly installed, 9 to remove and 0 not upgraded. Need to get 0B of archives. After unpacking 566MB will be freed.
This should do the same thing and is about 70 chars shorter. Show Sample Output
This will remove all installed kernels on your debian based install, except the one you're currently using. From: http://tuxtweaks.com/2009/12/remove-old-kernels-in-ubuntu/comment-page-1/#comment-1590
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.
Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?
You must be signed in to comment.
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for:
uname -a
before you start maybe someone could add a confirm question?aptitude remove $(dpkg -l|awk '/^ii linux-image-2/{print $2}'|sed 's/linux-image-//'|awk -v v=`uname
is not working on mine: it tries to uninstall the actual kernel i use as well !!!!!!VERY DANGEROUS!!!!!!!! useuname -a
before to see what you are doing!!!