Apt-get dist-upgrade -y 与 apt-get upgrade

Apt-get dist-upgrade -y 与 apt-get upgrade

我一直都在思考这个问题,但还没有找到答案。有人能解释一下为什么一些来源在升级命令后加上 -y 吗?它的作用是什么。

答案1

  • apt-get update从存储库下载软件包列表并“更新”它们以获取有关软件包及其依赖项的最新版本的信息。它将对所有存储库和 PPA 执行此操作。

    https://linux.die.net/man/8/apt-get

              Used to re-synchronize the package index files from their sources. 
              The indexes of available packages are fetched from the location(s) 
              specified in /etc/apt/sources.list(5). An update should always be 
              performed before an upgrade or dist-upgrade.
    
  • apt-get upgrade如果 APT 通过 apt-get update 了解了这些新版本,则会获取机器上现有软件包的新版本。

    https://linux.die.net/man/8/apt-get

              Used to install the newest versions of all packages currently
              installed on the system from the sources enumerated in 
              /etc/apt/sources.list(5). Packages currently installed with new 
              versions available are retrieved and upgraded; under no 
              circumstances are currently installed packages removed, nor
              are packages that are not already installed retrieved and 
              installed. New versions of currently installed packages that 
              cannot be upgraded without changing the install status of another 
              package will be left at their current version. An update must be 
              performed first so that apt-get knows that new versions of 
              packages are available. 
    
  • -y, --yes, --assume-yes

              Automatic yes to prompts; assume "yes" as answer to all prompts and
              run non-interactively. If an undesirable situation, such as
              changing a held package, trying to install a unauthenticated
              package or removing an essential package occurs then apt-get will
              abort. Configuration Item: APT::Get::Assume-Yes.  
    

    如果您选择不使用apt-getwith-y选项,则需要以交互方式回答从该命令获得的所有提示,以便继续执行该命令。

相关内容