Linux apt delete program

What is the correct way to completely remove an application?

So, what is the correct way? Is it necessary to use that «*»? After that, I also found these commands:

sudo updatedb sudo locate application sudo rm -rf (file/folder name) 

application* can on occasion give unexpected results — for example, if you have a file in the current directory named application_information , the shell would expand it before it’s passed to apt-get. If this is happening and you do want the literal asterisk, you can use application\* or ‘application*’

application* is even more dangerous where there are no files in the current directory: apt-get uses regular expressions, no glob patterns. People have almost wiped the whole system trying to remove wine* .

Neither application* nor application\* is safe! Quoting * with \ or ‘ ‘ only increases the risk, ensuring * is passed as-is to apt-get (though it usually is anyway!), causes apt-get to interpret the argument as a regex. In a regex * means «zero or more of the preceding character.» A common form of the mistake is to uninstall wine* , removing all packages with win (not wine , win ) anywhere in their names and all packages depending on any of them. See this explanation and possible fixes. @Izkata

9 Answers 9

  • apt-get remove packagename will remove the binaries, but not the configuration or data files of the package packagename . It will also leave dependencies installed with it on installation time untouched.
  • apt-get purge packagename or apt-get remove —purge packagename will remove about everything regarding the package packagename , but not the dependencies installed with it on installation. Both commands are equivalent. Particularly useful when you want to ‘start all over’ with an application because you messed up the configuration. However, it does not remove configuration or data files residing in users home directories, usually in hidden folders there. There is no easy way to get those removed as well.
  • apt-get autoremove removes orphaned packages, i.e. installed packages that used to be installed as an dependency, but aren’t any longer. Use this after removing a package which had installed dependencies you’re no longer interested in.
  • aptitude remove packagename or aptitude purge packagename (likewise) will also attempt to remove other packages which were required by packagename on but are not required by any remaining packages. Note that aptitude only remembers dependency information for packages that it has installed.

And many more exist. Lower-level dpkg -commands can be used (advanced), or GUI tools like Muon, Synaptic, Software Center, etc. There’s no single ‘correct way’ of removing applications or performing other tasks interacting with your package management.

The list you found are just examples. Make sure you understand the meanings and try out what it wants to do before accepting the action (you need to press Y before it actually performs the actions as proposed).

The asterisk version in the question is probably wrong; apt-get accepts a regular expression and not a glob pattern as the shell. So what happens with

sudo apt-get remove application* 
  1. The shell tries to expand application* looking at the files in the current directory. If (as is normally the case) it finds nothing, it returns the glob pattern unaltered (supposing bash with default behavior here — zsh will error out).
  2. apt-get will remove the packages whose name contains a string that satisfies the regular expression application* , that is, applicatio followed by an arbitrary number of n : applicatio , application , applicationn , libapplicatio , etc.
  3. To see how this can be dangerous, try (without root for double safety) apt-get -s remove «wine*» ( -s will simulate the thing instead of doing it) — it will say is going to remove all packages that has «win» in their name and the dependant, almost the entire system.
Читайте также:  Как посмотреть где лежит файл linux

Probably, the command that was meant is really

 sudo apt-get remove "^application.*" 

(note the quotes and the dot) which will remove all packages whose name starts with application .

are completely outside the scope of the package management. Do not remove files belonging to packages without using the package manager! It will get confused and is the wrong way to do things.

If you don’t know to which package a file belongs, try this:

Источник

How to Uninstall Programs from your Ubuntu System

Remove Ubuntu applications

This article describes removing software from your Ubuntu system that you do not need anymore. We are describing software removal both through the graphical user interface (Ubuntu Software Manager) and the command line-the (Terminal).

Please note that you need administrative privileges to install/uninstall any software from Ubuntu.

We have run and tested the commands and procedures mentioned in this article on Ubuntu 22.04 and Ubuntu 20.04.

Uninstall Applications Through Ubuntu Software Manager

One way to uninstall software from your computer is through the Ubuntu Software Manager. Click on the Ubuntu Software icon in the Activities toolbar; this will open the Ubuntu Software manager through which you can search for, install and uninstall software from your computer.

Then click the Installed tab from the following view to list all the applications installed on your Ubuntu system:

Ubuntu Software Manager

From the list of applications, look up the one you want to uninstall and then click the Remove button against it.

List of installed applications

In this example, I am removing software called XCFA from my system by clicking the Remove button against it. When you try to remove an application, the following type of confirmation message appears:

Uninstall app

Click the Remove button when you are sure that you want to remove the selected application. When you do so, the following authentication dialog will appear as only an authorized user can remove an application from Ubuntu:

Get administrator privileges

Enter the password for an Administrator or a sudo user, and then click the Authenticate button.

The selected software will now be removed from your system.

Uninstall Applications Through the Command Line

You can remove installed software from your system through apt-get remove and apt-get purge commands as sudo. But first, you need to know the exact package name through which you installed the software.

The following command will list all the packages installed on your system:

You may want to copy the exact package name, select it, right-click, and then copy it from the dpkg list for further use.

Читайте также:  Mc linux выделение файлов

Use apt-get remove command

The apt-get remove command removes software from your system but keeps the configuration files and any plugins and settings you might have installed later. This helps keep the same settings when you want to reinstall the software.

Run the following command as sudo to remove the software;

$ sudo apt-get remove package-name

You will be asked for the password for sudo and given the information about what will be removed from your system.

In this example, I will remove the OpenJDK package named “openjdk-11-jdk” from my system.

Uninstall Ubuntu package with apt

The system will also prompt with a y/n option to re-confirm the uninstall procedure. When you click Y, the process will begin, and the software will be removed from your system.

Use apt-get purge command

If you want to remove an application altogether from your system, also removing any personalized settings, it is best to use the apt-get purge command.

In this example, I will remove the OpenJDK package named “openjdk-11-jdk:amd64” from my system.

Run the following command as sudo to remove the software;

$ sudo apt-get purge package-name

You will be asked for the password for sudo and given the information about what will be removed from your system.

Remove application completely with apt-get purge

The system will also prompt with a y/n option to re-confirm the uninstall procedure. When you click Y, the process will begin and the software will be removed from your system.

Bonus: Cleanup the Mess with autoremove

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:

This will list all the obsolete and unused packaged and leftover dependencies taking up important space on your system.

Remove package dependencies that are not required anymore

The apt package manager will also prompt you to confirm the uninstall process again. When you click Y, the process begins, and the unwanted software dependencies are removed from your system.

You have learned that there are two ways to uninstall the software from your Ubuntu system: via the Ubuntu Software Manager and via the command line. From the command line, you can remove the software and keep all configuration files (apt-get remove) or remove the software altogether (apt-get purge).

Источник

How can I uninstall software?

Seeing there are various ways to install on Ubuntu. What are the various ways to uninstall items? Which ways always work? How can I be sure something was uninstalled?

11 Answers 11

If the application has been installed via the package manager, all you have to do is run

That should always work. If the terminal isn’t what stirs your tea, you could open System → Administration → Synaptic Package Manager, search for the package you want to remove, click on the checkbox next to it and select «mark for removal». Once you click «Apply», the package should be removed. There’s of course also the Ubuntu Software Center. It’s pretty much the same thing as Synaptic. Just search for the application name and click the «Remove» button.

Sometimes applications can be split up into multiple packages (for example, many games have a separate package for their music). To make sure that you uninstall all related packages AND configuration files, you can type

Читайте также:  Thunderbird exchange настройка linux

or -in Synaptic- «mark for complete removal» instead of just «mark for removal».

As for applications that have been manually compiled and installed, there’s not always a single way to remove them. The best thing to do is consult the README/INSTALL file that accompanied the source package — if one exists.

In the

Install synaptic

  • Synaptic : the same

A program selected with the option

 sudo apt-get remove && sudo apt-get autoremove 

It’s important to note that when you install things, they often depend on other packages. When you fire off apt-get remove it doesn’t remove the automatically-installed applications by default. This is often safer (if you’re temporarily removing something like ubuntu-desktop) but this can mean you end up with a load of cruft.

aptitude will automatically remove things (as well as having a nice interactive command line interface)

You can also search for cruft in synaptic using the «local or obsolete» filter under the status section.

the apt-get-version can be shorter & easier: sudo apt-get autoremove

+1 for autoremove it looks like that also removes dependencies that were installed along with the original program? nice to keep from cluttering things up.

To find the package you want to remove, use

Copy the package name and then use command

Here’s a rundown of the possible ways:

If the package has been installed via a package manager, you can remove it with one of the tools provided with this purpose:

  • dpkg —remove : the most basic command-line tool. Avoid.
  • apt-get remove or aptitude remove : these are the standard command-line tools. Aptitude is slightly preferred: it’s a bit more sophisticated. E.g., it can keep a log file of all package operations.
  • synaptic : GUI tool accessible through the GUI menu under «System/Administration». Supports all features, a very nice program generally.
  • software center : even nicer GUI than synaptic . This is a better, updated version of the old «Add/Remove Programs»

All these get the job done. You can start with the most user-friendly (Software Center) and continue to aptitude, if you need certain features or install or remove programs very frequently.

Note that these operations remove the bulk of the program while sometimes leaving «configuration files» in locations such aus /etc/apache2. Most software doesn’t have configuration files there; some server software («daemons») do. In all but a few cases, keeping these configuration files will do no harm. If you want to remove everything, including configuration files, then you can use the «purge» operation. For aptitude, the command line is «aptitude purge.» (Tommy’s explication above of «purge» is not accurate. The «remove» operation, just like «purge», deletes all dependencies that were pulled in with the original program.)

If the program tells you the package has been removed, you can be sure that the files are gone. Sometimes packages installed as a matter of dependency are not removed immediately. They will be eventually deleted, at a subsequent run.

As to software installed from other channels (typically compiled from source), you’re mostly forced to remove the files installed manually. They are often located somewhere in /usr/local . Some software provides shortcuts such as «make uninstall». Don’t count on it, though. More often than not, the cleanest solution is to use the version provided through Ubuntu’s repositories, which can be uninstalled cleanly.

Источник

Оцените статью
Adblock
detector