Cleaning up Linux boot partition

in #linux8 years ago (edited)

Here's an example set of commands used to clean up a Linux boot  partition. Of course, replace exact image and header numbers with  appropriate version numbers vis-à-vis your machine.

dpkg --list 'linux-image*'
sudo apt-get --purge remove linux-image-3.16.0-41-generic
dpkg --list 'linux-headers**'
sudo apt-get --purge remove linux-headers-3.16.0-41

You can also use df -h to see disk usage before and after.

(Reposted from my tumblr.)

Sort:  

Just make sure you keep at least one bootable kernel installed. ;)

Nice post.
Just remeber to do:
sudo apt-get autoclean && apt-get autoremove -y
** After you have rebooted your system to the new kernel.

I think you have to sudo the second command too, ie.
sudo apt-get autoclean && sudo apt-get autoremove -y

nop, just one. It's one command.

Congratulations @magician8! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You got a First Reply

Click on any badge to view your own Board of Honnor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

An additional step:

ls /boot

Remove all the old files that look something like:

initrd.img-4.4.0-70-generic.old-dkms

These files can take up a lot of room if you have a lot of old kernels.