如何获取 Arch Linux 中最后安装/升级的软件包列表(pacman
包括yaourt
时间戳)?
答案1
获取最后的列表已安装包,你可以运行:
grep -i installed /var/log/pacman.log
最后安装的软件包的示例输出:
[2015-08-24 15:32] [ALPM] warning: /etc/pamac.conf installed as /etc/pamac.conf.pacnew
[2015-08-24 15:32] [ALPM] installed python-packaging (15.3-1)
[2015-08-24 15:32] [ALPM] installed python2-packaging (15.3-1)
[2015-08-25 10:37] [ALPM] installed ttf-ubuntu-font-family (0.80-5)
[2015-08-25 10:43] [ALPM] installed ttf-google-fonts (20150805.r201-1)
[2015-08-25 10:44] [ALPM] installed ttf-ubuntu-font-family (0.80-5)
[2015-08-26 17:39] [ALPM] installed mozilla-extension-gnome-keyring-git (0.10.r36.378d9f3-1)
获取最后的列表升级版包,你可以运行:
grep -i upgraded /var/log/pacman.log
最后升级包的输出示例:
[2015-08-27 10:00] [ALPM] upgraded libinput (0.99.1-1 -> 1.0.0-1)
[2015-08-27 10:00] [ALPM] upgraded python2-mako (1.0.1-1 -> 1.0.2-1)
[2015-08-27 16:03] [ALPM] upgraded tdb (1.3.6-1 -> 1.3.7-1)
[2015-08-27 16:03] [ALPM] upgraded ldb (1.1.20-1 -> 1.1.21-1)
[2015-08-27 16:03] [ALPM] upgraded python2-mako (1.0.2-1 -> 1.0.2-2)
获取最后的列表已安装或者升级版包,你可以运行:
grep -iE 'installed|upgraded' /var/log/pacman.log
最后升级包的输出示例:
[2015-08-25 09:56] [ALPM] upgraded jdk (8u51-2 -> 8u60-1)
[2015-08-25 10:37] [ALPM] installed ttf-ubuntu-font-family (0.80-5)
[2015-08-25 10:43] [ALPM] installed ttf-google-fonts (20150805.r201-1)
[2015-08-25 10:44] [ALPM] installed ttf-ubuntu-font-family (0.80-5)
[2015-08-26 17:39] [ALPM] installed mozilla-extension-gnome-keyring-git (0.10.r36.378d9f3-1)
[2015-08-27 10:00] [ALPM] upgraded curl (7.43.0-1 -> 7.44.0-1)
[2015-08-27 10:00] [ALPM] upgraded gc (7.4.2-2 -> 7.4.2-3)
[2015-08-27 10:00] [ALPM] upgraded kmod (21-1 -> 21-2)
[2015-08-27 10:00] [ALPM] upgraded libinput (0.99.1-1 -> 1.0.0-1)
[2015-08-27 10:00] [ALPM] upgraded python2-mako (1.0.1-1 -> 1.0.2-1)
[2015-08-27 16:03] [ALPM] upgraded tdb (1.3.6-1 -> 1.3.7-1)
[2015-08-27 16:03] [ALPM] upgraded ldb (1.1.20-1 -> 1.1.21-1)
[2015-08-27 16:03] [ALPM] upgraded python2-mako (1.0.2-1 -> 1.0.2-2)
答案2
尽管只列出上次更新调用期间升级的软件包会很好,但它不适合一个漂亮的单行代码。
所以要延长来自@BuZZ-dEE 的回答,这是我的方法,列出了自上次更新之日起所有升级的软件包:
grep -iE "$(tail -n1 /var/log/pacman.log | grep -iEo "([0-9]{4}-[0-9]{2}-[0-9]{2})").+upgraded" /var/log/pacman.log