Port or Package Installation Date

There are a number of times that I need to find out when a port or package was last upgraded or installed.  This comes in very handy every time I need to upgrade all my ports and I can’t remember how far back I need to check in /usr/ports/UPDATING.

 

You can use one of the following command to list the last time the port was updated or installed:

 

# pkg query '%t' <pkg-name>

or for a port..

# pkg query '%t' `pkg info -q -O <port-name>`

 This will list all the installed ports, sorted by date, and print out the date in a normal readable format.

# pkg query '%t %n' | sort -h | awk '{"date -j -r " $1 | getline pkgdt; print pkgdt " " $2; close(cmd)}'

 This will list all the entries in /usr/ports/UPDATING that you have ports for and are since your oldest installed port.

# pkg updating -d $(date -j -r $(pkg query '%t' | sort -h | head -1) "+%Y%m%d")

Leave a Comment

Your email address will not be published.