Trying to unravel a command after the fact

A while ago I used instructions linked to on this forum to remove snap. Everything went fine, no regrets. There was a cleanup step that I wish I'd been more careful with, however. Output suggested it'd removed a bunch of cruft from .deb packages that past purges/autoremoves had not, but I would've liked to look at what the command was passing to dpkg --purge, just to improve my understanding of stuff left behind, and can't, because... well, it's purged. It's been a few weeks, and I still get nothing from that command; whatever was purged has not built back up. As such, just what is the grep in this line passing to awk? I assume awk is just formatting it for input to xargs.

dpkg -l | grep '^rc' | awk '{print $2}' | xargs dpkg --purge

This portion listed the packages that have been removed - but left behind configuration files. The r is removed and c is configuration files

This targets the second column which is the package name

xargs feeds the list provided by awk to dpkg with the command to purge those files.

As to what they were... You might check your uninstall history, since that above command only focuses on software that has already been uninstalled.

Thanks. The first two parts of your answer were what I was looking for. I got a list of what exactly got removed as output from the command and saw nothing I hadn't removed in the past, including some old Nvidia driver related stuff that was apparently missed by the purge in the steps I usually follow (or maybe left behind during Zorin's install). Seems like a good thing to include if I'm doing driver or kernel changes going forward.

That was in fact the purpose of the command. It came from the video below, which was linked in an old post of @swarfendor437's. (Command is in the pinned comment.) It's just been bugging me since I thought --purge got this stuff, but I would rather generally understand what I'm doing, even if I'm willing to go in blind when I have a recent backup.

The video I mentioned and source of this command:

1 Like