如何在Terminal中列出作为依赖项安装的所有软件包,以及安装它们的内容?

在终端中是否有一种方法可以列出我尚未安装的所有程序,但其他程序是必要的依赖项? 我可以同时查看他们安装的程序吗?

使用aptitude作为包管理器的高级接口,但您必须先安装它

 sudo apt-get install aptitude 

之后

 aptitude search '?installed(?automatic)' 

查看自动安装的软件包列表。


并同时查看他们安装的程序:

  • Depends

     aptitude -F %p search '?installed(?automatic)' | \ while read x ; do aptitude why "$x" | awk '/Depends/' ; done 
  • 或完整列表

     aptitude -F %p search '?installed(?automatic)' | \ while read x ; do aptitude why "$x"; done 

样本输出

 i texlive-full Depends lcdf-typetools i A lcdf-typetools Depends aglfn i python3-apparmor-click Depends apparmor-easyprof i aptitude Depends aptitude-common (= 0.6.11-1ubuntu3) i arronax Depends arronax-base i arronax Depends arronax-nautilus i ubuntu-dev-tools Depends devscripts (>= 2.11.0~) i lxc-docker Depends lxc-docker-1.7.1 i gnome-common Depends autopoint i A nvidia-prime Depends bbswitch-dkms i calibre Depends python-pil | python-imaging i A python-pil Depends mime-support | python-pil.imagetk i A python-pil.imagetk Depends python-tk (>= 2.7.7-2) i A python-tk Depends blt (>= 2.4z-9) i bluegriffon Depends bluegriffon-data (= 1.7.2-1~getdeb2~raring) i playonlinux Depends cabextract 

密切相关: 生成手动安装的软件包列表并查询各个软件包

使用:

 apt-mark showauto 

这列出了自动安装的软件包,而不是手动安装的软件包。

在命令行中使用此管道: apt list --installed | xargs apt-cache showpkg > dependencies.txt apt list --installed | xargs apt-cache showpkg > dependencies.txt 。 要小心它需要很长时间才能使用你所有的cpu。 我将它传输到一个文件,因为它是一个很长的列表。 管道的第一部分提供所有已安装的软件包,第二部分使用它们中的每一个并查找它们的依赖项。