I like to pass output of this command:
dpkg --list | grep 'linux-image\|linux-headers\|linux-modules' | grep '6.5.0-060500rc3' | awk '{print $2}'
which is:
linux-headers-6.5.0-060500rc3
linux-headers-6.5.0-060500rc3-generic
linux-image-unsigned-6.5.0-060500rc3-generic
linux-modules-6.5.0-060500rc3-generic
to this next command:
sudo apt-get purge
I tried to use xargs
but getting errors:
root@cubic:~# dpkg --list | grep 'linux-image\|linux-headers\|linux-modules' | grep '6.5.0-060500rc3' | awk '{print $2}' | xargs -I{} sudo apt purge {}
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
linux-headers-6.5.0-060500rc3* linux-headers-6.5.0-060500rc3-generic*
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 111 MB disk space will be freed.
Do you want to continue? [Y/n] Abort.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
linux-headers-6.5.0-060500rc3-generic*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 27.9 MB disk space will be freed.
Do you want to continue? [Y/n] Abort.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
linux-image-unsigned-6.5.0-060500rc3-generic*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 14.1 MB disk space will be freed.
Do you want to continue? [Y/n] Abort.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
linux-image-unsigned-6.5.0-060500rc3-generic* linux-modules-6.5.0-060500rc3-generic*
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 595 MB disk space will be freed.
Do you want to continue? [Y/n] Abort.
root@cubic:~# dpkg --list | grep 'linux-image\|linux-headers\|linux-modules' | grep '6.5.0-060500rc3' | awk '{print $2}'
linux-headers-6.5.0-060500rc3
linux-headers-6.5.0-060500rc3-generic
linux-image-unsigned-6.5.0-060500rc3-generic
linux-modules-6.5.0-060500rc3-generic
I’m running this commands inside Cubic environment on Ubuntu MATE. Thanks.
You must log in or # to comment.
Try this:
outter_command $(inner | command string)
I used
-y
:dpkg --list | grep 'linux-image\|linux-headers\|linux-modules' | grep '6.5.0-060500rc3' | awk '{print $2}' | xargs -I{} sudo apt purge -y {}
and there were a lot of errors but it did purge those kernels. Please let me know if there’s better way. Thanks.