The OP's suggested commands and the existing answer are correct, particularly according to the man page, but it turns out apt
's behaviour is slightly more flexible than the documentation suggests.
To make the command line more concise when removing a package and its automatically installed dependencies, you can supply a package name to the autoremove command, as in apt autoremove <pkg>
, in which case it behaves as apt remove --autoremove <pkg>
. Thus, apt autoremove --purge <pkg>
and apt purge --autoremove <pkg>
both produce the same result.
Going further, apt autopurge <pkg>
behaves in the same way as the canonical form apt remove --purge --autoremove <pkg>
, and seems to be the most concise way to achieve recursive purging.
Whether or not to document this behaviour has apparently been controversial among the developers.