0

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?

4
  • 2
    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. – steeldriver Jun 21 at 16:41
  • Try to use the more or less command. Are there any special options in pg that do not have a counterpart in these commands? – FedonKadifeli Jun 21 at 19:39
  • Does it matter that I might just want it to give me comfort? – ardevain Jun 21 at 20:48
  • 2
    @ardevain well, if there's nothing particular in pg you need, alias pg=less? – muru Jun 22 at 1:17
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.