Uninstall of software
Sometimes when I install software using the sudo apt-get install <package>
command the package may take minutes to be installed and in the end it may occupy some gb of space. If I uninstall it using sudo apt-get purge <package>
then it may be uninstalled in seconds and very little space (some kb or mb) may be removed from the original that it occupied when installed! Obviously that means that this is not a clean uninstall and that my pc is full of undeleted files. Why is that happening and how should I uninstall packages cleanly and fully?
Solution 1:
When you install a package, it may also need to install dependencies for it to work - for instance installing torcs
(e.g. with sudo apt-get install torcs
), it needs torcs-data
etc to work - they are also installed, and are fairly large in size (so also take time to download etc).
When removing torcs
(e.g. with sudo apt-get remove torcs
), it will likely leave the torcs-data
packages and other no longer needed packages behind, taking up space. You can solve this by running sudo apt-get autoremove <package>
, or sudo apt-get autoremove
after removing it with purge
/remove
.
You can also you the --purge
option with autoremove
to remove left over configuration files.
An extra way of clearing space is to use sudo apt-get clean
, to clear out the repo information and cached packages which also take up space. You will likely need to run sudo apt-get update
afterwards.
Here are the relevant entries from the manual page:
purge
purge is identical to remove except that packages are removed and
purged (any configuration files are deleted too).
clean
clean clears out the local repository of retrieved package files.
It removes everything but the lock file from
/var/cache/apt/archives/ and /var/cache/apt/archives/partial/. When
APT is used as a dselect(8) method, clean is run automatically.
Those who do not use dselect will likely want to run apt-get clean
from time to time to free up disk space.
autoremove
autoremove is used to remove packages that were automatically
installed to satisfy dependencies for some package and that are no
more needed.