Читать книгу Mastering Linux System Administration - Richard Blum - Страница 62
Uninstalling Software with apt
ОглавлениеGetting rid of software packages with apt
is as easy as installing and upgrading them. The only real choice you have to make is whether to keep the software's data and configuration files around afterward.
To remove a software package but not the data and configuration files, use apt
's remove
command. To remove a software package and the related data and configuration files, use the purge
option.
$ sudo apt purge zsh Reading package lists… Done Building dependency tree Reading state information… Done The following package was automatically installed and is no longer required: zsh-common Use 'sudo apt autoremove' to remove it. The following packages will be REMOVED: zsh* 0 upgraded, 0 newly installed, 1 to remove and 56 not upgraded. After this operation, 2,390 kB disk space will be freed. Do you want to continue? [Y/n] y (Reading database … 180985 files and directories currently installed.) Removing zsh (5.8-3ubuntu1) … Processing triggers for man-db (2.9.1-1) … (Reading database … 180928 files and directories currently installed.) Purging configuration files for zsh (5.8-3ubuntu1) … $
Notice, though, as part of the purge
output, apt
warns us that the zsh‐common
package that was installed as a dependency wasn't removed automatically, just in case it might be required for some other package. If you're sure the dependency package isn't required by anything else, you can remove it using the autoremove
command.
$ sudo apt autoremove Reading package lists… Done Building dependency tree Reading state information… Done The following packages will be REMOVED: zsh-common 0 upgraded, 0 newly installed, 1 to remove and 56 not upgraded. After this operation, 15.6 MB disk space will be freed. Do you want to continue? [Y/n] y (Reading database … 180928 files and directories currently installed.) Removing zsh-common (5.8-3ubuntu1) … Processing triggers for man-db (2.9.1-1) … $
The autoremove
command will check for all packages that are marked as dependencies and no longer required.