For FreeBSD there's a tool called
pkg_cutleaves, which is a very handy
tool to quickly remove unneeded packages; you get a list of all packages that
can be removed without breaking other packages in EDITOR and you remove the
lines of packages you want removed in your editor. Save, quit, confirm, and the
packages will be removed.
None of the Linux systems that I've worked with (Arch, Ubuntu, CentOS) come with
such a tool, nor have I been able to find one that works as well as
So here it is!
This only implements the visual mode (as described in the opening paragraph),
and not the interactive mode, as I find that to be much more useful. Note that
the flags are not compatible with
It currently only works for Arch Linux (pacman) and Void Linux (xbps), but its design should make it easier to add other platforms as well. rpm, dpkg, and FreeBSD were supported in earlier versions, but I added them with little testing four years ago, and wasn't confident they're correct, so I commented them out again.
Feel free to test, develop, and open a PR!