A User Command to Clean and Update System

That is a little different as you only did one cycle of pacman -R. That will remove orphans but often creates new orphans.

https://wiki.archlinux.org/title/pacman/Tips_and_tricks#Removing_unused_packages_(orphans)

i have tested it with the command:

pacman -Qtdq | pacman -Rns -

it’s similar to

pacman -R $(pacman -Qtdq)

Edit:
both commands remove the same packages, but not the ones that are additionally displayed to me with ‘yay -Yc’.

Okay…

I could have sworn I already wrote something for everyone that covers all of this. . . Hmm

It may be similar in your specific test case, but it is very different and won’t provide the same results in all cases.

…run as root does not create any new dpendencies, I guess that is why the Arch Wiki is recommending that way.
:wink:

You don’t mean this guide, now do you :laughing: