當前位置: 首頁>>技術教程>>正文


使用’-‘(減號/連字符)安裝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/zh-tw/article/11786.html,未經允許,請勿轉載。