Your Linux Data Center Experts

Tonight Scott was having problems with mutt suddenly having a garbled display. One of the things we wanted to do was to display packages by installed date to see what had changed recently. This is always annoying to find because I can never remember how to get the installed time or the list of available tags. Here's how…

First of all, you can get a list of the available tags for use with “–queryformat” with “–querytags”:

guin:~$ rpm --querytags | grep -i install

I always want to call it “installdate” instead of “installtime”. So:

guin:~$ rpm -qa \
>   --queryformat '%{installtime} (%{installtime:date}) %{name}\n' | \
>   sort -n | tail -5
1193758513 (Tue Oct 30 09:35:13 2007) smolt-firstboot
1193758519 (Tue Oct 30 09:35:19 2007) python-devel
1193758532 (Tue Oct 30 09:35:32 2007) subversion
1193758541 (Tue Oct 30 09:35:41 2007) subversion-perl
1193758545 (Tue Oct 30 09:35:45 2007) tkinter

Note that the “%{installtime:date}” specifies that the installtime should be formatted as a date string. Otherwise, it's the time_t seconds since Jan 1, 1970 (which is great for sorting, but not for reading).

comments powered by Disqus

Join our other satisfied clients. Contact us today.