this post was submitted on 07 Aug 2023
6 points (100.0% liked)

Linux

8043 readers
65 users here now

Welcome to c/linux!

Welcome to our thriving Linux community! Whether you're a seasoned Linux enthusiast or just starting your journey, we're excited to have you here. Explore, learn, and collaborate with like-minded individuals who share a passion for open-source software and the endless possibilities it offers. Together, let's dive into the world of Linux and embrace the power of freedom, customization, and innovation. Enjoy your stay and feel free to join the vibrant discussions that await you!

Rules:

  1. Stay on topic: Posts and discussions should be related to Linux, open source software, and related technologies.

  2. Be respectful: Treat fellow community members with respect and courtesy.

  3. Quality over quantity: Share informative and thought-provoking content.

  4. No spam or self-promotion: Avoid excessive self-promotion or spamming.

  5. No NSFW adult content

  6. Follow general lemmy guidelines.

founded 1 year ago
MODERATORS
 

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.

top 2 comments
sorted by: hot top controversial new old
[โ€“] [email protected] 3 points 1 year ago

Try this: outter_command $(inner | command string)

[โ€“] TheJack 2 points 1 year ago

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.