【问题标题】:How to view all installed packages in terminal (Ubuntu)如何在终端(Ubuntu)中查看所有已安装的软件包
【发布时间】:2017-02-06 08:08:58
【问题描述】:

需要通过终端查看我系统上安装的所有包。 我正在使用 ubuntu 16.10

【问题讨论】:

  • 你试过谷歌搜索吗?

标签: linux ubuntu terminal apt


【解决方案1】:
# dpkg -l

来自 dpkg 手册:

dpkg-查询操作 有关以下操作的更多信息,请参阅 dpkg-query(1)。

          -l, --list package-name-pattern...
              List packages matching given pattern.
          -s, --status package-name...
              Report status of specified package.
          -L, --listfiles package-name...
              List files installed to your system from package-name.
          -S, --search filename-search-pattern...
              Search for a filename from installed packages.
          -p, --print-avail package-name...
              Display details about package-name, as found in
              /var/lib/dpkg/available. Users of APT-based frontends
              should use apt-cache show package-name instead.

【讨论】:

    【解决方案2】:

    列出仅由您安装的软件包:

    gunzip -c /var/log/apt/history.log.*.gz | grep 'apt-get install' | cut -f4- -d" " | tr ' ' $'\n' | sort -u
    

    【讨论】:

      【解决方案3】:

      解决方法:为了在linux Ubuntu中查看所有已安装的包,在终端apt --installed list上运行,

      使用 apt 标志,可以看到对某些软件包 (--upgradeable)/当前安装的软件包 (--installed)/所有可用版本 (--all-versions) 的可用升级。

      来自文档

      DESCRIPTION
             apt provides a high-level commandline interface for the package management system. 
             It is intended as an end user interface and enables some options better suited for interactive usage by
             default compared to more specialized APT tools like apt-get(8) and apt-cache(8).
      
             Much like apt itself, its manpage is intended as an end user interface and as such only mentions the most 
            used commands and options partly to not duplicate information in multiple places and
             partly to avoid overwhelming readers with a cornucopia of options and details.           
      

      list 标志提供 3 个选项:

      list (work-in-progress)
                 list is somewhat similar to dpkg-query --list in that it can display a 
                 list of packages satisfying certain criteria. It supports glob(7) 
                 patterns for matching package names as well as
                 options to list installed (--installed), upgradeable (--upgradeable) or 
                 all available (--all-versions) versions.
      

      【讨论】:

        【解决方案4】:

        列出所有已安装包的命令

        sudo apt list --installed
        

        您可以添加“grep”来查找您的服务,如下所示:

        sudo apt list --installed | grep <my_service_name>
        

        【讨论】:

          【解决方案5】:

          我使用了以下三种 Cmd 语法并对其进行了测试,以从 VB6 Shell() 函数列出我的 ubuntu 子系统机器上安装的包,其中 2 个运行良好:

          1- 语法-#1:[有效]

          sudo apt list --已安装

          2- 语法-#2:[有效]

          sudo dpkg -l

          语法-#3:[对我来说不起作用..]

          sudo dpkg -l | grep -i apache

          这是我的 VB6 - 代码列表:

          私有子命令1_Click()

          Dim Id3 As Variant ' 1- Syntax-#1:工作正常: Id3 = Shell(App.Path & "\bash.exe | sudo apt list --installed", vbNormalFocus)

          ' 2- 语法-#2:也适用:' Id3 = Shell(App.Path & "\bash.exe | sudo dpkg -l", vbNormalFocus)

          ' 3- 语法-#3:不显示输出...为什么.. 现在不知道:'
          Id3 = Shell(App.Path & "\bash.exe | sudo dpkg -l | grep -i apache", vbNormalFocus) 结束子**

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2016-12-04
            • 1970-01-01
            • 2020-08-11
            • 1970-01-01
            • 2013-11-23
            • 2019-12-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多