簡體   English   中英

如何在終端 (Ubuntu) 中查看所有已安裝的軟件包

[英]How to view all installed packages in terminal (Ubuntu)

需要通過終端查看我系統上安裝的所有軟件包。 我正在使用 ubuntu 16.10

# dpkg -l

來自 dpkg 手冊:

dpkg-query 操作 有關以下操作的詳細信息,請參閱 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.

列出僅由您安裝的軟件包:

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

解決方案:為了查看 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.

我使用了以下三個 Cmd 語法並測試了它們以從 VB6 Shell() 函數列出我的 ubuntu 子系統機器上已安裝的軟件包,其中 2 個工作正常:

1-語法-#1:[工作]

sudo apt list --installed

2-語法-#2:[工作]

須藤 dpkg -l

語法-#3:[ 對我不起作用 .. ]

須藤 dpkg -l | grep -i 阿帕奇

這是我的 VB6 - 代碼列表:

Private Sub Command1_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) End Sub**

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM