How to clean orphan packages in one line

wsadev01

Aitor

Posted on November 27, 2020

How to clean orphan packages in one line

I am not a GNU/Linux master, nor a terminal expert, i was going to make a bash script to clean orphan packages, then i read this...

Using arrays or loops in shells is often signs of bad coding practice.


... So i decided to research about awk, and i did this one-line command to clean your orphan pacman packages sudo pacman -R $(pacman -Qdt | awk '{print $1}')

  • pacman -Qdt: Used to display the orphan packages.
  • awk '{print $1}': Prints the first field of the output.

e.g

💖 💪 🙅 🚩
wsadev01
Aitor

Posted on November 27, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related