Determine package installation time

Hi all,

Recently I've been installing a few packages as dependencies for a php application.
After some testing I decided to not use it. Now I'd like to clean up my system again.

For that I could either go in my screen buffer and find out what I installed or in my command history. However my session got disconnected and I don't have those.

So now my question is if and how I can see when a package has been installed.
In rhel/centos you have yum.log which gives a good view on what happened.
But man pkg-info doesn't seem to show this.

Thanks in advance!
 
So now my question is if and how I can see when a package has been installed.
It's logged in /var/log/messages:

Code:
Oct 15 23:31:19 armitage pkg: libressl-2.4.3 installed
Oct 15 23:31:23 armitage pkg: python27 reinstalled: 2.7.12 -> 2.7.12 
Oct 15 23:31:27 armitage pkg: perl5 reinstalled: 5.20.3_15 -> 5.20.3_15 
Oct 15 23:31:27 armitage pkg: ca_root_nss upgraded: 3.27 -> 3.27.1 
Oct 15 23:31:27 armitage pkg: wget reinstalled: 1.18 -> 1.18 
Oct 15 23:31:29 armitage pkg: vim-lite upgraded: 8.0.0019_1 -> 8.0.0035 
Oct 15 23:31:29 armitage pkg: openntpd reinstalled: 6.0p1_1,2 -> 6.0p1_1,2 
Oct 15 23:31:30 armitage pkg: nmap reinstalled: 7.30 -> 7.30 
Oct 15 23:31:30 armitage pkg: lynx reinstalled: 2.8.8.2_4,1 -> 2.8.8.2_4,1 
Oct 15 23:31:31 armitage pkg: libevent2 reinstalled: 2.0.22_1 -> 2.0.22_1 
Oct 15 23:31:31 armitage pkg: irssi reinstalled: 0.8.20 -> 0.8.20 
Oct 15 23:31:31 armitage pkg: haproxy reinstalled: 1.6.9 -> 1.6.9 
Oct 15 23:31:32 armitage pkg: bind-tools reinstalled: 9.10.4P3 -> 9.10.4P3
 
The install time of a package is also recorded in the package database and can be looked up with e.g. pkg info package or pkg query %t package or for all packages ordered by install time with pkg query '%t %o' | sort.
 
Silly me :s I just skipped the most obvious things: checking /var/log/messages and pkg info.
Thanks for supplying the pkg-info, pkg query and /var/log/messages way.

As for pkg-autoremove: I'm somewhat reluctant to use this one. I assume it only removes the packages that have not been explicitly installed?
In my case these dependencies have been explicitly installed (as the project I tested was a git repository).
Isn't there a chance pkg removes more packages than it actually should? I recall some issues with RHEL that did that(of course FreeBSD not being RHEL or Linux :) ).
 
As for pkg-autoremove: I'm somewhat reluctant to use this one. I assume it only removes the packages that have not been explicitly installed?
pkg autoremove -n will do a dry-run, and will only show you the packages he think are not needed anymore. If nothing else it is an aid to look at a relatively short list of orphaned packages.

Yes, you are correct, it will remove only packages installed automatically.

And, while I had similar problem in Linux, this tools has always worked nicely for me in FreeBSD.
 
The default configuration of pkg(8) will always ask before executing (with the default action set to No). So it's fairly safe to do.

If you want to keep something that pkg-autoremove(8) would delete you can set that package to non-automatic:
pkg set -A 0 <packagename>

See pkg-set(8).
 
Back
Top