Remove Package in Ubuntu: Linux How to Uninstall
This tutorial demonstrates how to quickly and easily uninstall software on Ubuntu. Uninstalling software can be done using several techniques. It shows you how to uninstall software using these various methods.
On Ubuntu, the main applications or methods used to install software packages are seen below.
Each of these methods have specific methods to uninstall software.
In preparation for uninstalling software from Ubuntu, you will need sudo permissions. By accessing the sudo permissions level, before running commands, you can avoid having to authenticate these root-level commands each time.
Different Operating Systems use various commands to execute actions. To interact with the packages on Ubuntu, you will typically want to use the apt command. You will see this command used numerous times in the instructions below. Let’s get started!
Find Installed Software
If you have an idea of what you want to uninstall, but you don’t know the exact name, you can find out the exact package names in Linux. You can also use the apt or dpkg command to see a list of all installed packages on your computer, press “Ctrl + Alt + T” to open a Terminal window. Type one the following command at the prompt and press “Enter”.
apt list --installed apt-cache search packagename or dpkg --list
Scroll through the list of installed packages in the Terminal window to find the one you want to uninstall. Note the full name of the package. Then, type in one of the following commands.
apt remove package_name apt remove package_name_1 package_name_2 apt purge package_name
These commands are useful for specific situations.
sudo apt-get clean
This command removes the aptitude cache located in /var/cache/apt/archives. When you install a program, the package file is downloaded and stored in that directory. You do not need to keep the data in that directory. However, the only drawback of deleting that information is that if you decide to re-install any of those programs again, the packages would have to be downloaded again.
Using the Apt-Get Purge Command for Ubuntu Uninstalls
The apt-get purge command removes a package and its configuration files. However, the dependencies for the package remain in the system, along with the configuration files in the home directory. Use the following command, substituting PACKAGE_NAME with the desired package for purging.
apt-get purge PACKAGE_NAME
Using the Apt-Get Remove Command for Ubuntu Uninstalls
The apt-get remove command is similar to the purge command, except the binaries and dependencies are all removed. Use the following command, again substituting PACKAGE_NAME with the desired package for removal.
apt-get remove PACKAGE_NAME
In case you want to remove any dependencies such as the applications and libraries used by the software you once installed that is no longer in use, you can do some housekeeping through the following command:
$ sudo apt-get autoremove
This command will list all the obsolete and unused packages and any leftover dependencies taking up valuable space on your system. The system will also prompt with a y/n option to reconfirm the uninstallation procedure. When you click Y, the process will begin, and the unwanted software dependencies will be removed from your system.
Using the -f Option
apt-get –f install
This option uses the -f flag to examine the installed applications and will attempt to repair or remove any packages it finds that are broken.
Uninstall Using a PPA
To uninstall Software installed via PPA, use the following two commands.
apt-get remove numix-gtk-theme numix-icon-theme-circle add-apt-repository --remove ppa:numix/ppa
The first command removes the software installed via the PPA. The second command removes the PPA from sources.list.
Synaptic is the GUI package manager for Ubuntu and is not usually installed on the server version of Ubuntu. It is included here to provide a more complete overview of uninstall methods. To uninstall software using Synaptic:
- Open the application.
- Scroll through the list of installed applications and click on the software to highlight it.
- Right-click and select Mark for Removal
- Click Apply.
This will uninstall the software, but leave the configuration files intact. To delete the associated configuration files along with the software, select Mark for Complete Removal instead.
To list software installed via dpkg, use one of these commands.
dpkg ––list dpkg–query –l | less
If you know the name of the software, you can search for the command using the less command. If you do not know the full name, you can also search for a partial name.
Before uninstalling a software package, it is a good practice to note the entire software name for accuracy. Run the following command and note the name of the software or application.
dpkg–query –l | grep package_name dpkg–query –l | grep *partial_name*
dpkg --remove packagename.
To Uninstall software that was set up from source code in Ubuntu
- First, you should not delete any source code you used to install the program.
- Second, you should ensure at installation, that there is a way to uninstall the program. A poorly configured program might not provide a way to uninstall the program, and then you’ll have to manually remove all the files installed by the software.
Typically, you should be able to uninstall the program by going to its extracted directory and using this command:
sudo make uninstall
You can also try to get a look at the steps used to install the software by running:
make -n install
and then noting all the directories mentioned during the installation process and manually remove the entries.
Normally, you can use the makefile to delete the executable file and all the object files from the directory by running the following command.
The make clean command usually cleans up the directories where the software was installed, however, it may not uninstall the package completely. Any dependencies needed or applied during the installation process may not be removed.
You can also use the checkInstall command instead of just running sudo make install, as that will likely put files all over the system with no easy way of removing them if things go wrong. In the future, if you try to install a package that contains the same file as the software you are compiling, you will receive errors, and the software you originally compiled may stop working.
In fact, checkinstall can keep track of files modified by any source install and not just a make install, so you can use it for any installation task outside apt, and it will keep track of the installation in the package manager.
Typically, Git simply clones an external repository to a local folder. If you used some form of non-standard prefix when configured so that a package has been installed under a specific hierarchy, (e.g. like under /opt/git/software/), then you can just recursively delete that folders hierarchy.
Snap provides an easy method to install or uninstall software. From the command line, you can use the following commands to locate and then remove the software.
snap list snap remove software
The list option provides an overview of all the installed snap packages. You can then use the remove option to remove the software.
Ubuntu Software Manager Uninstall
To uninstall software using the Ubuntu Software Manager, you should click on the icon in the Activities toolbar. This will open the Ubuntu Software Manager where you can search for, install and uninstall software from your computer. In the list of applications, you would look up the software you want to uninstall, and then click the Remove button to uninstall it.
If you’re short on space, you can use the “clean” command to remove downloaded archive files, as shown below.
If an application was installed using Flatpak, you can begin by either searching for the application or listing all the applications installed via Flatpak. You can then use the uninstallation option with flatpak by using the flatpak command along with the application id to remove the installed Flatpak software.
flatpak search flatpak list flatpak uninstall
Since the AppImage software is not "installed" in the normal sense of the word, you do not need to "uninstall" it. You simply have to delete the AppImage file and the application will be removed (but, this will not remove the data the application has created and/or downloaded). Also, you should remove menu entries by removing the desktop file from $HOME/.local/share/applications/.
Files and directories with names starting with a dot, like
.example which are concealed, may need to be unhidden. You can probably find it in the settings of the file manager you use or in many file managers. You can usually accomplish this using the ctrl+h keyboard sequence.
There are multiple methods of installing and uninstalling software on Ubuntu. These functions ensure your systems are kept clean and up to date.
If you need a new Ubuntu server for your next project, Liquid Web offers VPS Hosting, Cloud Dedicated Servers, and Dedicated Servers with the Ubuntu operating system. Contact our sales team for more information.
- How to Edit the PHP Memory for Your WordPress Site via WP Toolkit
- 4 Methods for How to Install Yarn on Windows Server
- How to Install Bpytop Resource Monitoring Tool on AlmaLinux
- How to Fix “This Site Can’t Provide a Secure Connection” Error
- How to Install MongoDB on AlmaLinux
- How to Install PostgreSQL on AlmaLinux
About the Author: Alison Gray
Alison Gray is currently an IT Project Manager at Liquid Web and has been with Liquid Web for nearly 10 years. In 2015, She earned her Bachelor's Degree in Media and Information from Michigan State University. In her free time, she loves spending time with her girlfriend and 3 kids. You can usually find her at a basketball court or some sort of sporting event. If the weather's right, she loves being outside in the yard finding some sort of yard work to do.
Our Sales and Support teams are available 24 hours by phone or e-mail to assist.
How to Edit the PHP Memory for Your WordPress Site via WP ToolkitRead Article
What is CGI-Bin and What Does it Do?Read Article
Top 10 Password Security StandardsRead Article
Top 10 Password Security StandardsRead Article
How to Use the WP Toolkit to Secure and Update WordPressRead Article