我是靠谱客的博主 简单羊,最近开发中收集的这篇文章主要介绍Ubuntu 干净卸载安装包,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

Uninstall a package via command line
There are actually three different commands that can be used to remove a package from Ubuntu. Two of those are apt and apt-get, and the other one is dpkg. Opting to use apt for removing packages is the most recommended approach, but for the sake of completeness, we’ll cover all methods.

First, you’ll need to know the name of the package you want to remove. Use one of the commands below to get a list of all the packages on your system. Pipe to grep if you have some idea of how the package might be named.
$ apt --installed
OR
$ dpkg -l
Once you have the name of the package, use apt or one of the other commands to remove it.
$ sudo apt remove package-name
OR
$ sudo apt-get remove package-name
OR
$ sudo dpkg -r package-name
Any of the above commands will remove the specified package, but they will leave behind configuration files, and in some cases, other files that were associated with the package. To remove those as well, you need to “purge” the package. You can do this either after removing a package or instead of removing a package (purging automatically implies removing as well).
$ sudo apt purge package-name
OR
$ sudo apt-get purge package-name
OR
$ sudo dpkg -P package-name
Uninstall a Snap package
The Snap package manager is somewhat new but it’s part of all newer versions of Ubuntu. It works independently of apt, so uninstalling software that was installed as a Snap package will require a separate command.

To see a list of installed Snap packages on your system, execute the following command in terminal.
$ snap list
After you’ve obtained the exact name of the package you wish to remove, use the following command to uninstall it.
$ sudo snap remove package-name
Uninstall unused packages
While installing some software, your package manager may download dependencies that are required to install a package properly. When it finishes installing a package, these dependencies will linger on your system but be unused. Therefore, it’s recommended to run the following command occasionally to remove any unused packages from your system.

$ sudo apt autoremove
Conclusion
In this guide, we learned how to uninstall a package in Ubuntu from both GUI and command line. The GUI method can be more convenient for some users but its power pales in comparison to the command line method. For the command line, it’s recommended that you stick to the apt command, as apt-get is more for system scripts and dpkg doesn’t handle dependencies as well as apt does.

最后

以上就是简单羊为你收集整理的Ubuntu 干净卸载安装包的全部内容,希望文章能够帮你解决Ubuntu 干净卸载安装包所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(57)

评论列表共有 0 条评论

立即
投稿
返回
顶部