command linepackage-management
I’ve searched the net for such information and found different command lines, like these ones:
sudo apt-get remove application
sudo apt-get remove application*
sudo apt-get remove --purge application
sudo apt-get remove --purge application*
sudo apt-get purge application
sudo apt-get purge 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)
Accepted Answer
-
apt-get remove packagename
will remove the binaries, but not the configuration or data files of the packagepackagename
. It will also leave dependencies installed with it on installation time untouched. -
apt-get purge packagename
orapt-get remove --purge packagename
will remove about everything regarding the packagepackagename
, 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
oraptitude purge packagename
(likewise)will also attempt to remove other packages which were required bypackagename
on but are not required by any remaining packages. Note thataptitude
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*
is the following:
- 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 (supposingbash
with default behavior here —zsh
will error out). -
apt-get
will remove the packages whose name contains a string that satisfies the regular expressionapplication*
, that is,applicatio
followed by an arbitrary number ofn
:applicatio
,application
,applicationn
,libapplicatio
, etc. - 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…
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
.
These commands,
sudo updatedb # <-- updates the locate database (index). harmless
sudo locate application # <-- locates the file 'application'. harmless
sudo rm -rf (file/folder name) # <-- removes files/dirs recursively. dangerous.
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:
dpkg -S /path/to/file
The post The Correct Way to Completely Remove an Application in Ubuntu! appeared first on Stack All Flow.
Top comments (0)