Debian或Ubuntu如何查看软件包的安装或者更新的日期
时间:2019-11-20 08:53:09 来源:igfitidea点击:
在Debian或Ubuntu Linux系统上,如何查看软件包的更新时间和安装日期?
查看软件包的安装日期
Debian软件安装日志文件在/var/log/dpkg.log
# tail -f /var/log/dpkg.log $ sudo tail -f /var/log/dpkg.log
输出示例:
2019-11-13 23:11:39 status not-installed linux-modules-5.3.0-18-generic:amd64 2019-11-13 23:11:39 purge linux-image-5.3.0-18-generic:amd64 5.3.0-18.19+1 2019-11-13 23:11:39 status config-files linux-image-5.3.0-18-generic:amd64 5.3.0-18.19+1 2019-11-13 23:11:39 status not-installed linux-image-5.3.0-18-generic:amd64 2019-11-13 23:11:39 startup packages configure
/var/log/dpkg.log可以使用logrotate进行滚动记录:
# ls -l /var/log/dpkg.log*
输出示例:
-rw-r--r-- 1 root root 9252 Jan 14 13:27 /var/log/dpkg.log -rw-r--r-- 1 root root 11658 Dec 16 03:53 /var/log/dpkg.log.1 -rw-r--r-- 1 root root 962 Nov 27 18:14 /var/log/dpkg.log.2.gz -rw-r--r-- 1 root root 2008 Oct 30 14:09 /var/log/dpkg.log.3.gz
可以使用zgrep或zmore命令(zcommands)搜索或查看压缩的日志文件:
# zmore /var/log/dpkg.log.5.gz # zless /var/log/dpkg.log.5.gz # zgrep 'remove' /var/log/dpkg.log.5.gz
Debian Linux查看软件安装日期和时间
运行以下grep命令:
# grep installed /var/log/dpkg.log
查看gzipd日志文件:
# zgrep installed /var/log/dpkg.log.3.gz
查看软件包升级日期和时间
# grep upgrade /var/log/dpkg.log # grep upgrade /var/log/dpkg.log.1 # zgrep upgrade /var/log/dpkg.log.2.gz
/var/log/apt/history.log历史记录
/var/log/apt/history.log文件也记录了软件安装的日志。
# tail -f /var/log/apt/history.log # more /var/log/apt/history.log # less /var/log/apt/history.log # grep -A4 -B4 'yyyy-mm-dd' /var/log/apt/history.log # grep -A4 '2016-01-14' /var/log/apt/history.log
使用dpkg查看软件包的信息
dpkg-query是一个工具,用于显示有关Debian或Ubuntu Linux下dpkg数据库中列出的软件包的信息。
但是,它不显示安装或更新日期:
dpkg-query -l