apt-get install with '-'(减号/连字符)删除包

Ond*_*žka 22 uninstall command-line apt

我正在寻找一些包 ( nautilus-terminal),并且不小心这样做了:

$ sudo apt-get install nautilus-
Reading package lists... Done                                                                                                                                                                                                 
Building dependency tree                                                                                                                                                                                                      
Reading state information... Done                                                                                                                                                                                             
The following packages were automatically installed and are no longer required:                                                                                                                                               
  apturl apturl-common libgail-3-0 linux-headers-4.4.0-57 linux-headers-4.4.0-57-generic linux-image-4.4.0-57-generic linux-image-extra-4.4.0-57-generic                                                                      
Use 'sudo apt autoremove' to remove them.                                                                                                                                                                                     
The following packages will be REMOVED:                                                                                                                                                                                       
  gnome-session-flashback nautilus nautilus-sendto nautilus-share ubuntu-desktop                                                                                                                                              
0 upgraded, 0 newly installed, 5 to remove and 69 not upgraded.                                                                                                                                                               
After this operation, 2 031 kB disk space will be freed.                                                                                                                                                                      
Do you want to continue? [Y/n] ^[[^C                                                                                                                                                                                          
Run Code Online (Sandbox Code Playgroud)

这是非常危险的,因为 remove 比来自失败的自动完成的简单破折号更难打错字。

那是等价的apt-get remove吗?我找不到任何文件。编辑:除了忽略手册页...

mur*_*uru 28

来自man apt-get

安装
   install 后跟一个或多个所需的软件包
   安装或升级。每个包都是一个包名,而不是一个
   完全限定的文件名(例如,在 Debian 系统中,
   apt-utils 将是提供的参数,而不是
   apt-utils_1.2.10_amd64.deb)。需要的所有包
   指定用于安装的包也将被检索和
   安装。/etc/apt/sources.list 文件用于定位
   所需的包。如果将连字符附加到包名称(带有
   没有中间空格),如果它被识别的包将被删除
   已安装。同样,加号可用于指定
   要安装的包。这些后面的功能可用于覆盖
   由 apt-get 的冲突解决系统做出的决定。

  • 此功能的基本原理是有时您想要安装与已安装的软件包冲突的软件包,但其中一个软件包需要其他软件包,因此这两个操作需要在同一次运行中。例如`apt install sysvinit-core systemd-sysv-`(*Essential* init 包需要)或`apt install msmtp postfix-`(许多包依赖于MTA)。 (3认同)