如何按最近安装的日期列出终端中所有已安装的软件?

如何按最近安装的日期列出终端中所有已安装的软件?

抱歉,可能之前问过但我似乎找不到。

谢谢!

答案1

尝试

zgrep -i "status installed"  /var/log/dpkg* | sort -t- -k1 -k2 -k3 -n > temp.txt

zgrep还允许您检查存档dpkg日志。例如,我看到:

$ ls /var/log/dpkg*
/var/log/dpkg.log  /var/log/dpkg.log.1  /var/log/dpkg.log.2.gz  /var/log/dpkg.log.3.gz  /var/log/dpkg.log.4.gz
$

然后输出通过管道传输sort

  • -t-指定-为字段分隔符
  • -k1-k2告诉-k3sort 按顺序使用这些字段
  • -n确保数字排序。
  • >将输出定向到文本文件,因为输出可能超过几百行

如果您想撤销订单,请参见man sort更多信息。-r

我在我的系统上使用命令看到的内容zgrep(删除了几行):

/var/log/dpkg.log.4.gz:2018-04-26 18:17:44 status installed base-files:amd64 10.1ubuntu2
/var/log/dpkg.log.4.gz:2018-04-26 18:17:44 status installed base-passwd:amd64 3.5.44
...
/var/log/dpkg.log.4.gz:2018-05-02 18:21:13 status installed linux-image-4.15.0-20-generic:amd64 4.15.0-20.21
/var/log/dpkg.log.4.gz:2018-05-02 18:21:56 status installed grub-gfxpayload-lists:amd64 0.7
/var/log/dpkg.log.4.gz:2018-05-02 18:21:56 status installed grub-pc:amd64 2.02-2ubuntu8
...
/var/log/dpkg.log.3.gz:2018-06-01 05:29:41 status installed netcat-openbsd:amd64 1.187-1ubuntu0.1
/var/log/dpkg.log.3.gz:2018-06-01 05:29:43 status installed man-db:amd64 2.8.3-2
/var/log/dpkg.log.3.gz:2018-06-02 13:59:20 status installed libkf5kmahjongglib-data:all 4:17.12.3-0ubuntu1
...
/var/log/dpkg.log.2.gz:2018-07-01 06:32:51 status installed ncdu:amd64 1.12-1
/var/log/dpkg.log.2.gz:2018-07-01 06:32:52 status installed man-db:amd64 2.8.3-2
/var/log/dpkg.log.2.gz:2018-07-02 07:20:02 status installed libastro1:amd64 4:17.12.3-0ubuntu1
...
/var/log/dpkg.log.1:2018-08-01 06:19:16 status installed chromium-codecs-ffmpeg-extra:amd64 68.0.3440.75-0ubuntu0.18.04.1
/var/log/dpkg.log.1:2018-08-01 06:19:16 status installed mime-support:all 3.60ubuntu1
/var/log/dpkg.log.1:2018-08-01 06:19:18 status installed man-db:amd64 2.8.3-2
...
/var/log/dpkg.log.1:2018-08-31 07:14:09 status installed libx11-data:all 2:1.6.4-3ubuntu0.1
/var/log/dpkg.log.1:2018-08-31 07:14:09 status installed man-db:amd64 2.8.3-2
/var/log/dpkg.log.1:2018-08-31 07:14:10 status installed libc-bin:amd64 2.27-3ubuntu1

这种方法的一个限制是,最终,一些存档文件将被删除,具体取决于logrotate设置方式。看看摆弄file:///etc/logrotate.d/dpkg,当然还有man logrotate

相关内容