![获取全新安装的软件包列表](https://linux22.com/image/973838/%E8%8E%B7%E5%8F%96%E5%85%A8%E6%96%B0%E5%AE%89%E8%A3%85%E7%9A%84%E8%BD%AF%E4%BB%B6%E5%8C%85%E5%88%97%E8%A1%A8.png)
我想要一个已安装的所有软件包的列表,以及 Ubuntu(任何版本)的全新安装中的版本(如果可能)。我可以使用
dpkg -l | grep '^ii' | awk '{print $2" "$3}'
在全新安装上,但这不是一个好主意,因为当有新版本的 Ubuntu 可用时,必须重新运行它。
我更喜欢有一个文件,列出所有已安装的软件包,而不是依赖脚本在所有系统上
答案1
要在文件中获取已安装软件包的列表,只需将您正在使用的命令的结果输出重定向到文件,如下所示:
dpkg -l | grep '^ii' | awk '{print $2" "$3}' >fresh-installed-pkg-list.txt
这将创建一个文件,其中包含所有已安装的软件包及其版本。
答案2
与 karel 的答案类似,但是来自 CD 图像本地:
$ head ./casper/filesystem.manifest
accountsservice 0.6.40-2ubuntu10
acl 2.2.52-3
acpi-support 0.142
acpid 1:2.0.26-1ubuntu2
adduser 3.113+nmu3ubuntu4
adwaita-icon-theme 3.18.0-2ubuntu3
alsa-base 1.0.25+dfsg-0ubuntu5
alsa-utils 1.1.0-0ubuntu5
anacron 2.3-23
app-install-data 15.10
我同意 karel 的观点,你不能确定所有需要安装或清理的软件包。
- 用户选择安装:
restricted
未列出,因为它们是直接从 debian 包安装的。(未在实时图像中预先提取) - 用户选择:语言、
grup-pc
/grup-efi
、加密、lvm。 - Ubiquity 将删除一些仅用于安装过程的软件包
这是我最后的安装日志,旨在提供有关已删除软件包的想法/示例
$ sudo grep Removing /var/log/installer/syslog
Jul 9 15:18:31 xubuntu grub-installer: Removing grub-gfxpayload-lists (0.7) ...
Jul 9 15:18:32 xubuntu grub-installer: Removing grub-pc (2.02~beta2-36ubuntu3) ...
Jul 9 15:18:33 xubuntu grub-installer: Removing grub-pc-bin (2.02~beta2-36ubuntu3) ...
Jul 9 15:20:00 xubuntu ubiquity: Removing btrfs-tools (4.4-1) ...
Jul 9 15:20:01 xubuntu ubiquity: Removing lupin-casper (0.57) ...
Jul 9 15:20:02 xubuntu ubiquity: Removing xubuntu-live-settings (16.04.6) ...
Jul 9 15:20:02 xubuntu ubiquity: Removing casper (1.376) ...
Jul 9 15:20:04 xubuntu ubiquity: Removing cifs-utils (2:6.4-1ubuntu1) ...
Jul 9 15:20:05 xubuntu ubiquity: Removing lvm2 (2.02.133-1ubuntu10) ...
Jul 9 15:20:07 xubuntu ubiquity: Removing dmraid (1.0.0.rc16-4.2ubuntu3) ...
Jul 9 15:20:09 xubuntu ubiquity: Removing kpartx-boot (0.5.0+git1.656f8865-5ubuntu2) ...
Jul 9 15:20:10 xubuntu ubiquity: Removing kpartx (0.5.0+git1.656f8865-5ubuntu2) ...
Jul 9 15:20:10 xubuntu ubiquity: Removing feh (2.14-1) ...
Jul 9 15:20:11 xubuntu ubiquity: Removing gparted (0.25.0-1) ...
Jul 9 15:20:13 xubuntu ubiquity: Removing jfsutils (1.1.15-2.1) ...
Jul 9 15:20:15 xubuntu ubiquity: Removing liblvm2app2.2:amd64 (2.02.133-1ubuntu10) ...
Jul 9 15:20:16 xubuntu ubiquity: Removing libdmraid1.0.0.rc16 (1.0.0.rc16-4.2ubuntu3) ...
Jul 9 15:20:17 xubuntu ubiquity: Removing libimlib2:amd64 (1.4.7-1build1) ...
Jul 9 15:20:18 xubuntu ubiquity: Removing libgif7:amd64 (5.1.2-0.2) ...
Jul 9 15:20:18 xubuntu ubiquity: Removing libgtkmm-2.4-1v5:amd64 (1:2.24.4-2) ...
Jul 9 15:20:19 xubuntu ubiquity: Removing libid3tag0 (0.15.1b-11) ...
Jul 9 15:20:20 xubuntu ubiquity: Removing libjpeg-progs (1:9b-1) ...
Jul 9 15:20:21 xubuntu ubiquity: Removing libjpeg9:amd64 (1:9b-1) ...
Jul 9 15:20:21 xubuntu ubiquity: Removing xfsprogs (4.3.0+nmu1ubuntu1) ...
Jul 9 15:20:22 xubuntu ubiquity: Removing libreadline5:amd64 (5.2+dfsg-3build1) ...
Jul 9 15:20:23 xubuntu ubiquity: Removing localechooser-data (2.65ubuntu4) ...
Jul 9 15:20:23 xubuntu ubiquity: Removing samba-common-bin (2:4.3.8+dfsg-0ubuntu1) ...
Jul 9 15:20:24 xubuntu ubiquity: Removing python-samba (2:4.3.8+dfsg-0ubuntu1) ...
Jul 9 15:20:25 xubuntu ubiquity: Removing python-crypto (2.6.1-6build1) ...
Jul 9 15:20:26 xubuntu ubiquity: Removing python-ldb (2:1.1.24-1ubuntu3) ...
Jul 9 15:20:26 xubuntu ubiquity: Removing python-tdb (1.3.8-2) ...
Jul 9 15:20:27 xubuntu ubiquity: Removing reiserfsprogs (1:3.6.24-3.1) ...
Jul 9 15:20:28 xubuntu ubiquity: Removing samba-common (2:4.3.8+dfsg-0ubuntu1) ...
Jul 9 15:20:32 xubuntu ubiquity: Removing ubiquity-slideshow-xubuntu (113) ...
Jul 9 15:20:33 xubuntu ubiquity: Removing user-setup (1.63ubuntu4) ...
Jul 9 15:20:45 xubuntu ubiquity: Removing dmeventd (2:1.02.110-1ubuntu10) ...
Jul 9 15:20:47 xubuntu ubiquity: Removing language-pack-gnome-bn-base (1:16.04+20160415) ...
Jul 9 15:20:48 xubuntu ubiquity: Removing language-pack-gnome-bn (1:16.04+20160415) ...
Jul 9 15:20:49 xubuntu ubiquity: Removing language-pack-bn-base (1:16.04+20160415) ...
Jul 9 15:20:50 xubuntu ubiquity: Removing language-pack-gnome-de-base (1:16.04+20160415) ...
Jul 9 15:20:50 xubuntu ubiquity: Removing language-pack-gnome-de (1:16.04+20160415) ...
Jul 9 15:20:51 xubuntu ubiquity: Removing language-pack-de-base (1:16.04+20160415) ...
Jul 9 15:20:52 xubuntu ubiquity: Removing language-pack-gnome-es-base (1:16.04+20160415) ...
Jul 9 15:20:53 xubuntu ubiquity: Removing language-pack-gnome-es (1:16.04+20160415) ...
Jul 9 15:20:54 xubuntu ubiquity: Removing language-pack-es-base (1:16.04+20160415) ...
Jul 9 15:20:55 xubuntu ubiquity: Removing language-pack-gnome-fr-base (1:16.04+20160415) ...
Jul 9 15:20:56 xubuntu ubiquity: Removing language-pack-gnome-fr (1:16.04+20160415) ...
Jul 9 15:20:56 xubuntu ubiquity: Removing language-pack-fr-base (1:16.04+20160415) ...
Jul 9 15:20:58 xubuntu ubiquity: Removing language-pack-gnome-hi-base (1:16.04+20160415) ...
Jul 9 15:20:58 xubuntu ubiquity: Removing language-pack-gnome-ja-base (1:16.04+20160415) ...
Jul 9 15:20:59 xubuntu ubiquity: Removing language-pack-gnome-pt-base (1:16.04+20160415) ...
Jul 9 15:21:00 xubuntu ubiquity: Removing language-pack-gnome-xh-base (1:16.04+20160214) ...
Jul 9 15:21:01 xubuntu ubiquity: Removing language-pack-gnome-zh-hans-base (1:16.04+20160415) ...
Jul 9 15:21:02 xubuntu ubiquity: Removing language-pack-hi-base (1:16.04+20160415) ...
Jul 9 15:21:03 xubuntu ubiquity: Removing language-pack-ja-base (1:16.04+20160415) ...
Jul 9 15:21:04 xubuntu ubiquity: Removing language-pack-pt-base (1:16.04+20160415) ...
Jul 9 15:21:05 xubuntu ubiquity: Removing language-pack-xh-base (1:16.04+20160214) ...
Jul 9 15:21:06 xubuntu ubiquity: Removing language-pack-zh-hans-base (1:16.04+20160415) ...
Jul 9 15:21:08 xubuntu ubiquity: Removing ubiquity-frontend-gtk (2.21.63) ...
Jul 9 15:21:10 xubuntu ubiquity: Removing liblvm2cmd2.02:amd64 (2.02.133-1ubuntu10) ...
Jul 9 15:21:10 xubuntu ubiquity: Removing gir1.2-timezonemap-1.0 (0.4.5) ...
Jul 9 15:21:11 xubuntu ubiquity: Removing gir1.2-xkl-1.0:amd64 (5.4-0ubuntu2) ...
Jul 9 15:21:12 xubuntu ubiquity: Removing language-pack-bn (1:16.04+20160415) ...
Jul 9 15:21:12 xubuntu ubiquity: Removing language-pack-de (1:16.04+20160415) ...
Jul 9 15:21:14 xubuntu ubiquity: Removing language-pack-es (1:16.04+20160415) ...
Jul 9 15:21:14 xubuntu ubiquity: Removing language-pack-fr (1:16.04+20160415) ...
Jul 9 15:21:15 xubuntu ubiquity: Removing language-pack-gnome-hi (1:16.04+20160415) ...
Jul 9 15:21:15 xubuntu ubiquity: Removing language-pack-gnome-ja (1:16.04+20160415) ...
Jul 9 15:21:16 xubuntu ubiquity: Removing language-pack-gnome-pt (1:16.04+20160415) ...
Jul 9 15:21:16 xubuntu ubiquity: Removing language-pack-gnome-xh (1:16.04+20160320) ...
Jul 9 15:21:17 xubuntu ubiquity: Removing language-pack-gnome-zh-hans (1:16.04+20160415) ...
Jul 9 15:21:18 xubuntu ubiquity: Removing language-pack-hi (1:16.04+20160415) ...
Jul 9 15:21:18 xubuntu ubiquity: Removing language-pack-ja (1:16.04+20160415) ...
Jul 9 15:21:19 xubuntu ubiquity: Removing language-pack-pt (1:16.04+20160415) ...
Jul 9 15:21:19 xubuntu ubiquity: Removing language-pack-xh (1:16.04+20160320) ...
Jul 9 15:21:20 xubuntu ubiquity: Removing language-pack-zh-hans (1:16.04+20160415) ...
Jul 9 15:21:21 xubuntu ubiquity: Removing libdevmapper-event1.02.1:amd64 (2:1.02.110-1ubuntu10) ...
Jul 9 15:21:21 xubuntu ubiquity: Removing libtimezonemap1:amd64 (0.4.5) ...
Jul 9 15:21:22 xubuntu ubiquity: Removing libtimezonemap-data (0.4.5) ...
Jul 9 15:21:23 xubuntu ubiquity: Removing ubiquity (2.21.63) ...
Jul 9 15:21:27 xubuntu ubiquity: Removing apt-clone (0.4.1ubuntu1) ...
Jul 9 15:21:28 xubuntu ubiquity: Removing archdetect-deb (1.117ubuntu2) ...
Jul 9 15:21:29 xubuntu ubiquity: Removing cryptsetup (2:1.6.6-5ubuntu2) ...
Jul 9 15:21:31 xubuntu ubiquity: Removing cryptsetup-bin (2:1.6.6-5ubuntu2) ...
Jul 9 15:21:32 xubuntu ubiquity: Removing dmsetup (2:1.02.110-1ubuntu10) ...
Jul 9 15:21:32 xubuntu ubiquity: Removing dpkg-repack (1.41) ...
Jul 9 15:21:33 xubuntu ubiquity: Removing ecryptfs-utils (111-0ubuntu1) ...
Jul 9 15:21:34 xubuntu ubiquity: Removing keyutils (1.5.9-8ubuntu1) ...
Jul 9 15:21:35 xubuntu ubiquity: Removing libdebian-installer4:amd64 (0.102ubuntu1) ...
Jul 9 15:21:36 xubuntu ubiquity: Removing libecryptfs1 (111-0ubuntu1) ...
Jul 9 15:21:36 xubuntu ubiquity: Removing libnss3-1d:amd64 (2:3.21-1ubuntu4) ...
Jul 9 15:21:37 xubuntu ubiquity: Removing libparted-fs-resize0:amd64 (3.2-15) ...
Jul 9 15:21:37 xubuntu ubiquity: Removing python3-icu (1.9.2-2build1) ...
Jul 9 15:21:38 xubuntu ubiquity: Removing python3-pam (0.4.2-13.2ubuntu2) ...
Jul 9 15:21:39 xubuntu ubiquity: Removing rdate (1:1.2-6) ...
Jul 9 15:21:40 xubuntu ubiquity: Removing ubiquity-casper (1.376) ...
Jul 9 15:21:40 xubuntu ubiquity: Removing ubiquity-ubuntu-artwork (2.21.63) ...