当前位置: 首页>>技术教程>>正文


使用’-‘(减号/连字符)安装apt-get会删除软件包

, ,

问题描述

我正在寻找一些软件包(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                                                                                                                                                                                          

这是非常危险的,因为与自动完成失败后的简单破折号相比,remove键入错误更困难。

那等于apt-get remove吗?我找不到任何文档。编辑:除了可以忽略手册页…

最佳方案

man apt-get

install
   install is followed by one or more packages desired for
   installation or upgrading. Each package is a package name, not a
   fully qualified filename (for instance, in a Debian system,
   apt-utils would be the argument provided, not
   apt-utils_1.2.10_amd64.deb). All packages required by the
   package(s) specified for installation will also be retrieved and
   installed. The /etc/apt/sources.list file is used to locate the
   desired packages. If a hyphen is appended to the package name (with
   no intervening space), the identified package will be removed if it
   is installed. Similarly a plus sign can be used to designate a
   package to install. These latter features may be used to override
   decisions made by apt-get's conflict resolution system.

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/11786.html,未经允许,请勿转载。