Saturday, 3 October 2026

Linux Operating System _ command _ 4

 

Source :  Internet



In Debian and Ubuntu-based systems, the apt purge command is used to uninstall a package along with its system-wide configuration files. This differs from a simple apt remove, which only deletes the package binaries but leaves configuration files intact.

When you run:

sudo apt purge package_name

it removes:

  • Package binaries (the executable files and libraries)

  • System-wide configuration files (usually stored in /etc)

However, user-specific configuration files in the home directory (e.g., ~/.config) are not removed. These must be deleted manually if you want a completely clean slate.

Example:

# Remove VLC and its system-wide configuration
sudo apt purge vlc

# Also remove unused dependencies
sudo apt autoremove

In this example, apt purge deletes VLC and its /etc configs, while apt autoremove cleans up libraries installed only for VLC.

Key Differences from Related Commands:

  • apt remove → Removes package binaries but keeps system-wide configs.

  • apt purge → Removes binaries and system-wide configs.

  • apt autoremove → Removes unused dependencies.

  • apt clean → Clears downloaded package files from cache.

Special Notes:

  • apt purge is equivalent to apt remove --purge — both perform the same action.

  • It does not delete user data/configs in the home directory.

  • Useful when you want to reset an application’s configuration to default before reinstalling.

  • After purging, running apt autoremove is recommended to clean up leftover dependencies.

Best Practice: Use apt remove for regular uninstalls when you might reuse the configuration later. Use apt purge when you want a fresh start or are troubleshooting misconfigurations.

No comments:

Post a Comment