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.

Top comments (1)
You can use
--noconfirmas an equivalent of-yin apt, to disable user confirmation ;)