如何完全删除Linux应用

您可以使用apt或Ubuntu软件删除Ubuntu和Debian中的应用程序,当您发现只有二进制文件被删除,而一些相关的配置和数据文件还保留在您的系统中。

你可以删除位于/etc文件夹的配置文件,以及位于/var 文件夹中的数据.对于特定用户数据,位于用户目录文件夹,只能手动删除.
You can remove the configuration files which are normally in the /etc folder along with the data which normally resides in the /var folder when uninstalling a program using apt. User-specific data which is stored in the user's home directory however will have to be manually deleted.

完全删除程序的步骤:

Steps to completely remove program in Ubuntu and Debian:

打开terminal
搜索这个包名,如果你不知道准确的名字
Launch terminal.
Search for package name if you dont know the exact name.

$ sudo apt list --installed | grep mariadb

**WARNING: apt does not have a stable CLI interface. Use with caution in scripts.**

mariadb-client-10.3/focal,now 1:10.3.22-1ubuntu1 amd64 [installed,automatic]
mariadb-client-core-10.3/focal,now 1:10.3.22-1ubuntu1 amd64 [installed,automatic]
mariadb-common/focal,now 1:10.3.22-1ubuntu1 all [installed,automatic]
mariadb-server-10.3/focal,now 1:10.3.22-1ubuntu1 amd64 [installed,automatic]
mariadb-server-core-10.3/focal,now 1:10.3.22-1ubuntu1 amd64 [installed,automatic]
mariadb-server/focal,now 1:10.3.22-1ubuntu1 all [installed]

彻底删除程序及其配置文件
Fully remove the program along with config files using apt.

$ sudo apt purge mariadb-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  galera-3 libcgi-fast-perl libcgi-pm-perl libconfig-inifiles-perl
  libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-perl
  libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl
  libhttp-date-perl libhttp-message-perl libio-html-perl
  liblwp-mediatypes-perl libmysqlclient21 libsnappy1v5 libterm-readkey-perl
  libtimedate-perl liburi-perl mariadb-client-10.3 mariadb-client-core-10.3
  mariadb-common mariadb-server-10.3 mariadb-server-core-10.3 mysql-common
  socat

**Use 'sudo apt autoremove' to remove them.**

The following packages will be REMOVED:
  mariadb-server*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 68.6 kB disk space will be freed.
Do you want to continue? [Y/n]
##### snipped

确认删除
Confirm deletion if asked.

完全删除未使用的依赖包以及配置文件
Completely remove unused dependent packages along with configuration file.

$ sudo apt autoremove --purge
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  galera-3* libcgi-fast-perl* libcgi-pm-perl* libconfig-inifiles-perl*
  libdbd-mysql-perl* libdbi-perl* libencode-locale-perl* libfcgi-perl*
  libhtml-parser-perl* libhtml-tagset-perl* libhtml-template-perl*
  libhttp-date-perl* libhttp-message-perl* libio-html-perl*
  liblwp-mediatypes-perl* libmysqlclient21* libsnappy1v5*
  libterm-readkey-perl* libtimedate-perl* liburi-perl* mariadb-client-10.3*
  mariadb-client-core-10.3* mariadb-common* mariadb-server-10.3*
  mariadb-server-core-10.3* mysql-common* socat*
0 upgraded, 0 newly installed, 27 to remove and 0 not upgraded.
After this operation, 173 MB disk space will be freed.
Do you want to continue? [Y/n]
##### snipped

核对配置文件以及数据是否存在
Check if configuration and data files still exist.

$ sudo ls -l /etc/mysql /var/lib/mysql
ls: cannot access '/etc/mysql': No such file or directory
ls: cannot access '/var/lib/mysql': No such file or directory
posted @ 2021-03-29 16:44  7bGWFm  阅读(587)  评论(0)    收藏  举报