[ANN] ph - a package history tool
by dive from LinuxQuestions.org on (#561XN)
Hi all.
I wrote this simple script to save typing. `ph', short for `package history', takes a few arguments, and saves having to type `/var/log/packages' many times. Note: to work properly, it does depend on the modification times of the files in /var/log/packages being correct.
https://slackbuilds.org/repository/14.2/system/ph/
Some examples:
List the last 10 packages installed:
Code:ph 10List the first 10:
Code:ph -10The `-g' option will match a filename glob. This would output the last 10 packages installed with the _SBo tag:
Code:ph 10 -g \*_SBoTo get a list of all packages with a `jack-' prefix:
Code:ph -g "jack-*"
or
ph | grep ^jack-Each package name is output with the version, and install date and time etc. E.G.:
Code:jack-1.9.14-x86_64-1_SBo Sun 12 Jul 2020 15:39:13There is also a `-s' shortcut for SBo packages. Special glob characters can either be escaped or quoted.
List of options:
Code:Output format options:
-v Omit VERSION to TAG.
-a Omit ARCH to TAG.
-t Omit TAG.
-A, --all Omit all but NAME (shorthand for -v -d.)
Date and time format options:
-d Omit date and time.
-f Use ISO-8601 format for date.
-i Use long-iso format for date.
-u UNIX time.
Glob options:
-g <GLOB> List only packages matching GLOB.
-p List patches (shorthand for -g "*_slack<release>") *.
-s List only SBo packages (equivalent to -g "*_SBo".)The man page explains all the options in more detail, with some examples of how to use the output with `removepkg' and also the `$ROOT' variable.
I hope it will be of some use to you.


I wrote this simple script to save typing. `ph', short for `package history', takes a few arguments, and saves having to type `/var/log/packages' many times. Note: to work properly, it does depend on the modification times of the files in /var/log/packages being correct.
https://slackbuilds.org/repository/14.2/system/ph/
Some examples:
List the last 10 packages installed:
Code:ph 10List the first 10:
Code:ph -10The `-g' option will match a filename glob. This would output the last 10 packages installed with the _SBo tag:
Code:ph 10 -g \*_SBoTo get a list of all packages with a `jack-' prefix:
Code:ph -g "jack-*"
or
ph | grep ^jack-Each package name is output with the version, and install date and time etc. E.G.:
Code:jack-1.9.14-x86_64-1_SBo Sun 12 Jul 2020 15:39:13There is also a `-s' shortcut for SBo packages. Special glob characters can either be escaped or quoted.
List of options:
Code:Output format options:
-v Omit VERSION to TAG.
-a Omit ARCH to TAG.
-t Omit TAG.
-A, --all Omit all but NAME (shorthand for -v -d.)
Date and time format options:
-d Omit date and time.
-f Use ISO-8601 format for date.
-i Use long-iso format for date.
-u UNIX time.
Glob options:
-g <GLOB> List only packages matching GLOB.
-p List patches (shorthand for -g "*_slack<release>") *.
-s List only SBo packages (equivalent to -g "*_SBo".)The man page explains all the options in more detail, with some examples of how to use the output with `removepkg' and also the `$ROOT' variable.
I hope it will be of some use to you.