Score:0

System V "pg" command

cn flag

I am an old System V guy, and I finally got around to setting up a Linux box, using Ubuntu, of course. One of the first things I noticed was missing is the "pg" command. The web tells me that it is available as part of the "util-linux" package. Ubuntu, which I loaded having checked the the boxes to "install everything," tells me that util-linux is installed, but "pg" and other scripting cammands simply aren't there. Can this be fixed?

hr flag
According to `apt-get changelog util-linux`, *util-linux (2.29.2-2) unstable; urgency=medium "The big post-release cleanup."* `* Stop shipping the deprecated 'pg' utility`.
FedKad avatar
cn flag
Try to use the `more` or `less` command. Are there any special options in `pg` that do not have a counterpart in these commands?
ardevain avatar
cn flag
Does it matter that I might just want it to give me comfort?
muru avatar
us flag
@ardevain well, if there's nothing particular in `pg` you need, `alias pg=less`?
Score:1
hr flag

Looking at the package changelog (apt-get changelog util-linux) you will see that pg has been deprecated and removed:

util-linux (2.29.2-2) unstable; urgency=medium

  "The big post-release cleanup."

  [ Andreas Henriksson ]
  * Add DEP12 upstream metadata (Closes: #852731)
  * Revert "Add configure flag to make libmount skip /etc/mtab"
  * Drop explicit --disable-silent-rules configure flag
  * Stop shipping the deprecated 'pg' utility
  * Revert "Explicitly (re)enable deprecated pg utility"
  * Stop shipping deprecated 'tunelp' utility
  * Stop shipping the deprecated 'line' utility
  * Drop explicitly passing CC for cross-building
  * Use configure flags to disable utils shipped by bsdmainutils
  * Revert "Attempt to work around debootstrap problems for hwclock.sh"
  * Drop no longer needed lintian overrides for dropped workaround
  * Drop obsolete fdisk reclaim on PPC
  * Revert "Rename libuuid user to uuidd in libuuidd1 postinst as well"
  * Revert "libuuid1: add passwd dependency for user migration"
  * Drop obsolete uuid-runtime user/group migration code
  * Remove 'pg' from being a pager alternative
  * Stop shipping deprecated tailf utility
  * Mention tailf removal in util-linux.NEWS</code></pre>

However the source code for pg is still present in the source package, so you can build and install it manually if you wish. You will need a suitable build environment such as provided by installing the build-essential package, plus relevant dependencies as provided by

sudo apt-get build-dep util-linux

First, make sure you have the deb-src type enabled for your main repository. Then you can download and patch the source in a directory of your choosing (unlike most apt operations, this doesn't need elevated privileges):

apt-get source util-linux

Change to the downloaded directory, and then configure the build to enable pg:

./configure --enable-pg

If it completes successfully,

make pg

Test it from the current directory using ./pg README or the like.

Now instead of the usual "sudo make install" (which will attempt to build all the utilities), just copy the pg binary somewhere appropriate such as ~/bin or /usr/local/bin

mkdir -p ~/bin && cp pg ~/bin/

If you choose ~/bin and didn't previously have a ~/bin directory, then it won't be added to your PATH until you start a new login shell or source the ~/.profile:

. ~/.profile

so that you can execute pg from anywhere.

Alternatively, you could build ALL of the package with --enable-pg, then use checkinstall to install it in place of the Ubuntu provided package - however you will then be responsible for keeping it updated.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.