I've been using Linux for about a month and a half, and I'm wondering what actually happens when software is removed. If I run commands such as `yay -R`, `apt remove`, or `dnf remove`, is the package returned to the exact state it was in before installation? Assume the package manager removes every file that came with the package itself. Would application caches, configuration files, logs, downloaded package archives, dependencies, or other data created while using the program still remain?
3 Answers
`apt autoremove` doesn’t clean up every leftover file. It removes packages that were automatically installed as dependencies and are no longer needed by anything else. With APT, `remove` removes the package’s installed files but normally keeps system-wide configuration files, while `purge` also removes those package-managed configuration files. Neither one normally removes data stored in your home directory, caches, logs, or files you created yourself.
Usually, uninstalling removes the files that belonged to the package itself, but it leaves data the application created later. That commonly includes per-user caches, settings, and application data in places such as `~/.cache`, `~/.config`, and `~/.local/share`. This is intentional—uninstalling a program generally shouldn’t delete documents or other data you created with it. Downloaded package archives may also remain in the package manager’s cache.
There isn’t one universal “completely gone” operation. Leftovers can include user configuration, caches, logs, package-manager download caches, manually created system configuration, and dependencies that are no longer needed. The exact cleanup options depend on the package manager and the application, so check where that program stores its data before deleting anything.

So even `apt purge` won’t remove application data under my home directory? I’d have to delete those files separately if I wanted a completely clean reinstall.