apt 删除 vs 清除

Cam*_*den 13 package-management apt purge

我看到sudo apt remove package_namesudo apt purge package_name
但有什么区别?一个比另一个更安全还是删除该软件包安装的软件包?

urb*_*ben 21

您可以阅读 apt 的手册

man apt
Run Code Online (Sandbox Code Playgroud)

第 35 行,您会发现以下内容

       Removing a package removes all packaged data, but leaves usually
       small (modified) user configuration files behind, in case the
       remove was an accident. Just issuing an installation request for
       the accidentally removed package will restore its function as
       before in that case. On the other hand you can get rid of these
       leftovers by calling purge even on already removed packages. Note
       that this does not affect any data or configuration stored in your
       home directory.
Run Code Online (Sandbox Code Playgroud)

简而言之: removepurge没有的地方留下一些配置文件。如果以后要删除这些配置文件,您甚至可以使用清除。


edw*_*ksl 6

apt-get(run man apt-getto see this)的联机帮助页说:

remove
    remove is identical to install except that packages are removed instead of installed. Note that removing a
    package leaves its configuration files on the system. If a plus sign is appended to the package name (with
    no intervening space), the identified package will be installed instead of removed.

purge
    purge is identical to remove except that packages are removed and purged (any configuration files are
    deleted too).
Run Code Online (Sandbox Code Playgroud)

简而言之,removepurge删除它们的同时保留配置文件。两者都是安全的,但选择哪一个取决于您是否要删除配置。

  • 正如我从这个问题中了解到的那样,`apt-get` 不一定与 `apt` 相同:https://askubuntu.com/questions/445384/what-is-the-difference-between-apt-and-apt- get 但是在这种情况下它没有区别。 (3认同)