sodcalculator

10 Tech How-To

Uninstall Command by Installation Method

Guide 10-59822 · Updated · Step by step

To match the uninstall command to how an app was installed, check the installation method first: package managers like apt, dnf, and pacman each have their own removal commands, while apps installed from source or as standalone binaries often need manual deletion. This guide covers the most common Linux package managers and manual installation types, explaining the exact commands and how to handle leftovers.

Why the Installation Method Matters

Linux systems manage software through package managers that track files, dependencies, and metadata. When you install a package with a manager, it records every file and can reverse the process cleanly. Installing from source or a tarball bypasses this tracking, so no uninstall command exists—you must manually remove the files you copied. Using the wrong uninstall command can leave orphaned configuration files or break dependencies, so matching the method is essential for a clean removal.

Debian/Ubuntu: apt and dpkg

On Debian-based systems, the apt command is the standard front-end. To remove a package but keep its configuration files, use:

sudo apt remove package-name

To remove the package and its configuration files, use:

sudo apt purge package-name

If you installed a .deb file directly with dpkg, you can uninstall it with:

sudo dpkg -r package-name

To also remove configuration, use dpkg -P. Note that apt automatically handles dependencies, while dpkg does not—you may need to manually remove orphaned dependencies with sudo apt autoremove.

Red Hat/Fedora: dnf and yum

Fedora and RHEL-based systems use dnf (or older yum). The removal command is:

sudo dnf remove package-name

For yum, the equivalent is sudo yum remove package-name. Both commands remove the package and its dependencies that are no longer needed. If you installed a .rpm file with rpm, use:

sudo rpm -e package-name

RPM does not resolve dependencies automatically, so you may need to remove dependent packages first.

Arch Linux: pacman

Arch uses pacman. To remove a package and its dependencies not required by others:

sudo pacman -Rns package-name

The -R removes the package, -n removes configuration files, and -s removes unneeded dependencies. If you installed from the AUR (Arch User Repository) with an AUR helper like yay, you can use the same command, but be aware that AUR packages are often built from source and may leave orphaned files.

Installed from Source or Manual Binary

If you compiled from source with make install, the standard uninstall is:

sudo make uninstall

This only works if the source code includes an uninstall target, which many projects do. If not, you must manually delete the files. To find them, you can check the install_manifest.txt file that some build systems generate, or use find / -name "program-name" to locate binaries. For standalone binaries placed in /usr/local/bin, simply delete the file and any associated configuration in /etc or ~/.config.

Snap, Flatpak, and AppImage

These modern packaging formats have their own removal commands:

  • Snap: sudo snap remove package-name
  • Flatpak: flatpak uninstall package-name
  • AppImage: delete the .AppImage file (no system integration)

Snap and Flatpak are sandboxed and store data in their own directories, so removal is clean. AppImage files are portable—just remove the file and any desktop entries you created.

How to Find the Installation Method

If you don’t remember how you installed an app, use these checks:

  • Check with your package manager: apt list --installed | grep name, dnf list installed | grep name, or pacman -Q | grep name
  • Check if it’s a Snap: snap list | grep name
  • Check if it’s a Flatpak: flatpak list | grep name
  • Look for the binary path: which program-name—if it’s in /usr/local/bin, it’s likely from source or manual install

If the package manager lists it, use the corresponding uninstall command. If not, it’s probably a manual installation.

Common Problems and Misconceptions

A frequent mistake is using apt remove on a package installed via dpkg—this usually works, but may leave configuration files. Conversely, using dnf remove on an RPM installed with rpm can fail if the package isn’t in the dnf database. Another misconception is that make uninstall always works; it only works if the project provides an uninstall target. Always check the project’s documentation.

Frequently Asked Questions

How do I uninstall an app installed with pip?

Python packages installed with pip can be removed with pip uninstall package-name. If you used pip install --user, the command is the same. For pipx, use pipx uninstall package-name.

What’s the difference between remove and purge in apt?

apt remove deletes the program files but keeps configuration files in /etc and user settings. apt purge deletes those too. If you plan to reinstall, use remove; if you want a clean slate, use purge.

How do I uninstall a program installed with a .deb file?

Use sudo dpkg -r package-name or sudo apt remove package-name. Both work, but apt will also handle dependencies. To find the exact package name, use dpkg -l | grep name.

Can I just delete the folder where the app was installed?

For source or manual installs, yes, but you may leave behind configuration files, systemd services, or symbolic links. Use find to locate all related files before deleting. For package-manager installs, never delete files manually—it breaks the package database.

Why does uninstalling leave dependencies behind?

Package managers often keep dependencies because they might be used by other programs. To remove unused dependencies, run sudo apt autoremove (Debian/Ubuntu) or sudo dnf autoremove (Fedora). On Arch, use sudo pacman -Rns to remove dependencies at the same time.

How do I uninstall an app installed with a script like install.sh?

First, check if the script has an uninstall option (./install.sh --uninstall). If not, you’ll need to manually remove the files it copied. Review the script to see what it did, then reverse those steps. Common locations are /usr/local/bin, /usr/local/lib, and /etc.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →