If you want to clean up your system, and
free some space on your system partiton, removing old unused kernel
versions is a good start.
NOTE: Before starting any of this, make
sure you have a solid back-up (There are several good GUI driven back-up
systems for Linux available, although I still like to run my own
scripts using rsync)
1. find out what the current kernel version is (open a Terminal screen):
uname -r
2. Do a test run and see what will be removed. (nothing will actually be removed. it is so called a dry - run command)
dpkg
-l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2
-d"-"` | grep -e [0-9] | xargs sudo apt-get --dry-run remove
3. If you are satisfied with the dry-run,
and are 100% sure it isn't killing your current kernel version, you can
do a real run, and remove the old kernel versions.
dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get -y purge
4. Update your Grub Menu (cleaning old menu entries to kernels that previous commands removed)
sudo update-grub2
5. Exit terminal screen and reboot. Your
grub menu should be updated and contain only the current kernel version
plus other bootable systems if you use dual or multi boot systems.
No comments:
Post a Comment
Please be courteous, even if you do not share the same view.