1

I'm looking for a way to list my installed packages on Arch Linux in order of their original install date (not the date the current version of the package was installed; the date of the very first time any version of it was installed). What I am looking for is a list of all of the packages I have installed on my system, in the order they were first installed. Is there any way to achieve that? So far, all of the ways I've found to list packages by date go by the date of the most recent upgrade, not the original install.

1 Answer 1

7

One simple way to list all the packages by install date is to use the log:

awk '/\[ALPM\] installed/ { print $(NF-1) }' /var/log/pacman.log

The log is the only way to get this information if you consider the "package installation date" to be independent of package version.

Here's another way that does consider the package to be tied to the package version -- if the package is upgraded, the determined install date will change.

export LC_ALL=C
while IFS= read -r pkg; do
    printf '%s %s\n' \
    "$(date -d "$(pacman -Qi "$pkg" | sed -n '/^Install Date/s/.* : //p')" +%s)" \
    "$pkg"
done < <(pacman -Qq) | sort -nk1

(This can be made faster using libalpm directly or by doing a single pacman -Qi and iterating each package with awk, but the code would be more complex.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .