How to remove a package?

QuestionsQuestions8 SkillsProYour First Linux LabSep, 27 2025
0199

To remove a package in a Debian-based system using the apt package manager, you can use the following commands:

Simple Removal

This command removes the package but keeps its configuration files:

sudo apt remove package-name

Complete Removal

If you want to remove the package along with its configuration files, use the purge command:

sudo apt purge package-name

Clean Up Unnecessary Packages

After removing a package, it's a good practice to clean up any packages that were automatically installed as dependencies but are no longer needed:

sudo apt autoremove

Example

For example, to remove the neofetch package, you would run:

sudo apt remove neofetch

Or, to completely remove it along with its configuration files:

sudo apt purge neofetch

After removal, you can verify that the package has been successfully removed by trying to run it:

neofetch

You should see an error message indicating that the command is not found.

0 Comments

no data
Be the first to share your comment!