Table of Content
When you uninstall an application from Linux, make sure you’re doing it in such a way as to remove both configuration files and dependencies.
If you’re using Ubuntu or any other Debian-based distribution in your data centers, on-premises servers, or desktops, you’ve probably run into an instance where you needed to uninstall a piece of software. So you log in and run the command: sudo apt-get remove packagename (where packagename is the actual name of the package to be removed).
However, doing that leaves behind a number of things, primarily dependencies and configuration files. These straggling apps and files not only take up space, but they could (“could” being the operative word) cause security issues. You don’t want that. So what do you do?
SEE: Choosing your Windows 7 exit strategy: Four options (TechRepublic Premium)
With just two simple commands you can cleanly remove those packages. What are those commands? Let me demonstrate.
Say you’ve installed WordPress on a server and want to cleanly remove it. To first uninstall WordPress and remove all configuration files, issue the command:
sudo apt-get purge wordpress
Once this command completes, you can then remove all of the dependencies that were installed alongside WordPress with the command:
sudo apt-get autoremove
When that final command finishes, WordPress will have been removed, along with all of its configuration files and dependencies. If you need to remove an application from a Linux server or desktop, using these two simple commands is the way to go.