I forgot one point: ...
Seems risky. Suppose I myself never used (for example) python, but it's "under the hood" of other packages (such as dnf). Would that command remove python?
... un-needed python only, I would like to say.
dnf is self-protected and -I guess- all dependent packages (python ?) too to make sure dnf is normally able to run see ls -l /etc/dnf/protected.d/ and prove: "sudo dnf remove dnf" => "Error: Problem: The operation would result in removing the following protected packages: dnf (try to add '--skip-broken' to skip uninstallable packages)"
in generall: there is an history regarding executed dnf commands: - sudo dnf history - sudo dnf history info <your number here> - sudo dnf history undo <your number here>
man dnf for more
dnf history lives under /var/lib/dnf