Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I have installed pgadmin using the ubuntu software center and am trying to access a local database (recently downloaded from the internet). I have tried to run the pg_ctl command (running as postgres) however this gives a command not found error. I have also ran the following commands:

echo $PATH: /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games 

so that's a bit of a weird place but still. whereis pg_ctl: pg_ctl: /usr/share/man/man1/pg_ctl.1.gz type pg_ctl: -su: so it's somewhere on my system type: pg_ctl: not found which looks wrong

apt-cache policy postgres-xc gives me a No such file or directory error the output of

sudo apt-get install postgres-xc is

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package postgres-xc

sudo apt-get -q update gives me :

Get:1 precise-security Release.gpg [198 B]
Get:2 precise-security Release [49.6 kB]
Get:3 precise-security/main Sources [93.6 kB]
Hit precise Release.gpg
Hit precise-updates Release.gpg
Hit precise-backports Release.gpg
Hit precise Release
Hit precise-updates Release
Get:4 precise Release.gpg [72 B]
Hit precise-backports Release
Hit precise Release
Hit precise/main Sources
Hit precise/restricted Sources
Hit precise/universe Sources
Hit precise/multiverse Sources
Hit precise/main amd64 Packages
Hit precise/restricted amd64 Packages
Hit precise/universe amd64 Packages
Hit precise/multiverse amd64 Packages
Hit precise/main i386 Packages
Hit precise/restricted i386 Packages
Hit precise/universe i386 Packages
Hit precise/multiverse i386 Packages
Hit precise/main TranslationIndex
Hit precise/multiverse TranslationIndex
Hit precise/restricted TranslationIndex
Hit precise/main Sources
Hit precise/universe TranslationIndex
Hit precise-updates/main Sources
Hit precise-updates/restricted Sources
Hit precise-updates/universe Sources
Hit precise-updates/multiverse Sources
Hit precise-updates/main amd64 Packages
Hit precise/main amd64 Packages
Hit precise/main i386 Packages
Ign precise/main TranslationIndex
Hit precise-updates/restricted amd64 Packages
Hit precise-updates/universe amd64 Packages
Hit precise-updates/multiverse amd64 Packages
Hit precise-updates/main i386 Packages
Hit precise-updates/restricted i386 Packages
Hit precise-updates/universe i386 Packages
Hit precise-updates/multiverse i386 Packages
Hit precise-updates/main TranslationIndex
Hit precise-updates/multiverse TranslationIndex
Get:5 precise-security/restricted Sources [2,494 B]
Get:6 precise-security/universe Sources [29.9 kB]
Hit precise-updates/restricted TranslationIndex
Hit precise-updates/universe TranslationIndex
Hit precise-backports/main Sources
Hit precise-backports/restricted Sources
Hit precise-backports/universe Sources
Hit precise-backports/multiverse Sources
Hit precise-backports/main amd64 Packages
Hit precise-backports/restricted amd64 Packages
Hit precise-backports/universe amd64 Packages
Hit precise-backports/multiverse amd64 Packages
Hit precise-backports/main i386 Packages
Hit precise-backports/restricted i386 Packages
Hit precise-backports/universe i386 Packages
Hit precise-backports/multiverse i386 Packages
Hit precise-backports/main TranslationIndex
Hit precise-backports/multiverse TranslationIndex
Hit precise-backports/restricted TranslationIndex
Hit precise-backports/universe TranslationIndex
Hit precise/main Translation-en
Hit precise/multiverse Translation-en
Hit precise/restricted Translation-en
Hit precise/universe Translation-en
Hit precise-updates/main Translation-en
Get:7 precise-security/multiverse Sources [1,797 B]
Get:8 precise-security/main amd64 Packages [347 kB]
Hit precise-updates/multiverse Translation-en
Hit precise-updates/restricted Translation-en
Hit precise-updates/universe Translation-en
Hit precise-backports/main Translation-en
Hit precise-backports/multiverse Translation-en
Hit precise-backports/restricted Translation-en
Hit precise-backports/universe Translation-en
Ign precise/main Translation-en_US
Ign precise/main Translation-en
Get:9 precise-security/restricted amd64 Packages [4,627 B]
Get:10 precise-security/universe amd64 Packages [85.4 kB]
Get:11 precise-security/multiverse amd64 Packages [2,439 B]
Get:12 precise-security/main i386 Packages [366 kB]
Get:13 precise-security/restricted i386 Packages [4,620 B]
Get:14 precise-security/universe i386 Packages [89.5 kB]
Get:15 precise-security/multiverse i386 Packages [2,635 B]
Hit precise-security/main TranslationIndex
Hit precise-security/multiverse TranslationIndex
Hit precise-security/restricted TranslationIndex
Hit precise-security/universe TranslationIndex
Hit precise-security/main Translation-en
Hit precise-security/multiverse Translation-en
Hit precise-security/restricted Translation-en
Hit precise-security/universe Translation-en
Fetched 1,081 kB in 0s (1,561 kB/s)

cat /etc/apt/sources.list gives me :

#deb cdrom:[Ubuntu 12.04.3 LTS _Precise Pangolin_ - Release amd64 (20130820.1)]/ dists/precise/main/binary-i386/

#deb cdrom:[Ubuntu 12.04.3 LTS _Precise Pangolin_ - Release amd64 (20130820.1)]/ dists/precise/restricted/binary-i386/
#deb cdrom:[Ubuntu 12.04.3 LTS _Precise Pangolin_ - Release amd64 (20130820.1)]/ precise main restricted

# See for how to upgrade to
# newer versions of the distribution.
deb precise main restricted
deb-src precise main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb precise-updates main restricted
deb-src precise-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb precise universe
deb-src precise universe
deb precise-updates universe
deb-src precise-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb precise multiverse
deb-src precise multiverse
deb precise-updates multiverse
deb-src precise-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb precise-backports main restricted universe multiverse
deb-src precise-backports main restricted universe multiverse

deb precise-security main restricted
deb-src precise-security main restricted
deb precise-security universe
deb-src precise-security universe
deb precise-security multiverse
deb-src precise-security multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb precise partner
# deb-src precise partner

## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb precise main
deb-src precise main
share|improve this question

3 Answers 3

up vote 4 down vote accepted

In 12.04 LTS:

$ cd ~
$ vim .profile
export PATH
$ . ~/.profile

And now you can execute the command from the shell:

pg_ctl --help
pg_ctl is a utility to initialize, start, stop, or control a PostgreSQL server.
share|improve this answer
Thanks JohnMerlino, Worked perfect for me. –  Nathan Crum Aug 21 '14 at 20:05
There's a reason pg_ctl for a particular pg version (e.g. 9.1, 9.4) is not in your $PATH on Ubuntu. If you upgrade Ubuntu, multiple pg versions may be running, and only pg_ctlcluster will take care of all of them. See @PeterEisentraut's more canonical answer. –  hobs Sep 6 at 19:27

You shouldn't run pg_ctl directly under Ubuntu/Debian. Use pg_ctlcluster instead, which is installed by postgresql-common. See its man page for documentation.

share|improve this answer
If you don't which version and cluster parameters you should use when calling pg_ctlcluster, check the output of pg_lsclusters. –  dusan Jan 13 at 18:45

Precise (12.04)

Precise doesn't include the postgres-xc package, but the postgresql-9.1 package includes the pg_ctl binary but in a non-standard directory!

sudo apt-get install postgresql-9.1

So, after you install the postgres package, you should find the binary in the above directory, adding it to your path should be a no-brainer export PATH=$PATH:/usr/lib/postgresql/9.1/bin/.

Quantal and newer (> 12.10)

Install the postgres-xc package:

sudo apt-get install postgres-xc

That package is the one that provides the pg_ctl binary. After you have installed it use the full path instead:


That way you prevent the command not found error.

share|improve this answer
This still gives me a file not found exception. –  Thijser Dec 5 '13 at 8:47
postgres-xc is incompatible with postgresql-9.1. It is a replacement database and not necessarily what the OP wants. –  phord Mar 21 '14 at 13:43
@phord I'm just adding more information for the future. –  Braiam Mar 21 '14 at 14:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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