列出所有手动安装的包类似于history.log文件

列出所有手动安装的包类似于history.log文件

我搜索了整个互联网,但没有找到任何令人满意的答案。

aptitude search ‘~i !~M’ | less

不显示手动安装的软件包。在我的系统上,它显示了一个巨大的列表:

i   accountsservice                 - query and manipulate user account informat
i   acl                             - Access control list utilities             
i   acpi-support                    - scripts for handling many ACPI events     
i   acpid                           - Advanced Configuration and Power Interface
i   add-apt-key                     - Command line tool to add GPG keys to the A
i   adduser                         - add and remove users and groups           
i   alsa-base                       - ALSA driver configuration files           
i   alsa-utils                      - Utilities for configuring and using ALSA  
i   anacron                         - cron-like program that doesn't go by time 
i   apache2                         - Apache HTTP Server                        
i   apache2-bin                     - Apache HTTP Server (binary files and modul
i   apache2-data                    - Apache HTTP Server (common files)         
i   apache2-mpm-prefork             - transitional prefork MPM package for apach
i   apg                             - Automated Password Generator - Standalone 
i   apt                             - commandline package manager               
:

以及其他许多人...

但显然我没有安装所有这些。另一方面,更有效的解决方案是:

zcat /var/log/apt/history.log.*.gz | grep 'apt-get install'

输出:

Commandline: apt-get install wine1.7 winetricks
Commandline: apt-get install ubuntu-restricted-extras
Commandline: apt-get install pi
Commandline: apt-get install gparted
Commandline: apt-get install virtualbox
Commandline: apt-get install ardour3
Commandline: apt-get install kubuntu-restricted-extras ubuntu-restricted-extras
Commandline: apt-get install apache2
Commandline: apt-get install tasksel

这些正是我手动安装的软件包。但上述解决方案的问题是日志可能会混乱。所以我想要的是来自某些 aptitude 命令的 history.log 文件的完全相同的输出。这样日志混乱就不会造成任何问题。

答案1

要获取本地安装的软件包列表,请运行以下命令:

dpkg --get-selections | grep -v deinstall

您可以保存所有已安装软件包的文件列表

dpkg --get-selections | grep -v deinstall > myInstalledPackages.txt

相关内容