如何在终端中查看所有已安装的包 (Ubuntu)
How to view all installed packages in terminal (Ubuntu)
需要通过终端查看我系统上安装的所有包。
我正在使用 ubuntu 16.10
# dpkg -l
来自 dpkg 手册:
dpkg-query actions
See dpkg-query(1) for more information about the following actions.
-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
我使用了以下三种 Cmd 语法并测试了它们以从 VB6 Shell() 函数列出我的 ubuntu 子系统机器上安装的软件包,其中 2 个工作正常:
1-语法-#1:[有效]
sudo apt list --installed
2-语法-#2:[有效]
sudo dpkg -l
语法-#3:[对我不起作用..]
须藤 dpkg -l | grep -i apache
这是我的 VB6 - 代码列表:
Private Sub Command1_Click()
Dim Id3 As Variant ' 1- Syntax-#1: Worked fine:
Id3 = Shell(App.Path & "\bash.exe | sudo apt list --installed", vbNormalFocus)
' 2- Syntax-#2: Worked Also: ' Id3 = Shell(App.Path & "\bash.exe
| sudo dpkg -l", vbNormalFocus)
' 3- Syntax-#3: Does not show output ... Why .. Dont know now: '
Id3 = Shell(App.Path & "\bash.exe | sudo dpkg -l | grep -i apache",
vbNormalFocus) End Sub**
解决方法:为了在终端apt --installed list
,linuxUbuntu,运行中查看所有安装的包,
使用 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.
列出所有已安装软件包的命令
sudo apt list --installed
您可以添加 'grep' 来查找您的服务,如下所示:
sudo apt list --installed | grep <my_service_name>
需要通过终端查看我系统上安装的所有包。 我正在使用 ubuntu 16.10
# dpkg -l
来自 dpkg 手册:
dpkg-query actions See dpkg-query(1) for more information about the following actions.
-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
我使用了以下三种 Cmd 语法并测试了它们以从 VB6 Shell() 函数列出我的 ubuntu 子系统机器上安装的软件包,其中 2 个工作正常:
1-语法-#1:[有效]
sudo apt list --installed
2-语法-#2:[有效]
sudo dpkg -l
语法-#3:[对我不起作用..]
须藤 dpkg -l | grep -i apache
这是我的 VB6 - 代码列表:
Private Sub Command1_Click()
Dim Id3 As Variant ' 1- Syntax-#1: Worked fine: Id3 = Shell(App.Path & "\bash.exe | sudo apt list --installed", vbNormalFocus)
' 2- Syntax-#2: Worked Also: ' Id3 = Shell(App.Path & "\bash.exe | sudo dpkg -l", vbNormalFocus)
' 3- Syntax-#3: Does not show output ... Why .. Dont know now: '
Id3 = Shell(App.Path & "\bash.exe | sudo dpkg -l | grep -i apache", vbNormalFocus) End Sub**
解决方法:为了在终端apt --installed list
,linuxUbuntu,运行中查看所有安装的包,
使用 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.
列出所有已安装软件包的命令
sudo apt list --installed
您可以添加 'grep' 来查找您的服务,如下所示:
sudo apt list --installed | grep <my_service_name>