Location of, or command to get installed date and time of a package.
Sundar Nagarajan
sundar.personal at gmail.com
Wed Jan 20 17:59:16 UTC 2010
Ray Parrish wrote:
> Is there a quick one line command that will return the installed date,
> and time of a software package in Linux, or Ubuntu more specifically?
>
> Alternatively, is that data in a file somewhere in the file system? I'm
> sure it is, as Synaptic Package Manager has the data to look at, I just
> do not know where it stores the data.
>
> I can parse the file myself, if I can discover where it resides.
The information is in /var/log/dpkg.log. Look for lines that contain:
' status installed '
The bummer is that these are system logs, which means that:
1. logrotate rotates out older entries into other files
2. Only a limited history is maintained (10 files).
Older entries are lost
The simple command below can be used as a starting point - it handles
[1] (but not [2]).
( for f in $(ls -r1 dpkg.log.*.gz); do gzip -dc $f ; done ; cat dpkg.log
) | fgrep ' status installed '
Field 5 is the package name, field 6 is the version, so you can pipe
this to awk to search for a particular package as below:
( for f in $(ls -r1 dpkg.log.*.gz); do gzip -dc $f ; done ; cat dpkg.log
) | fgrep ' status installed ' | awk -F' ' '$5=="mailutils" {print $1,
$2, $5, $6}'
Replace mailutils with the package name you are interested in
This will return one line for every version that was installed
(including updates). If you want only the most RECENT install, pipe the
output of the above to 'tail -1'.
Hope that helps,
Sundar.
--
Sundar Nagarajan
Linux User #170123 | Ubuntu User #2805
More information about the ubuntu-users
mailing list