PostgreSQL 9.4.8 Ubuntu 16.04 64 bit
I just want an explanation of what is happening here. Why is this command not found? Nothing else.
malikarumi@Tetuoan2:/usr/lib/postgresql/9.4/bin$ pg_ctl stop -m fast
pg_ctl: command not found
malikarumi@Tetuoan2:/usr/lib/postgresql/9.4/bin$ sudo pg_ctl stop -m fast
[sudo] password for malikarumi:
sudo: pg_ctl: command not found
malikarumi@Tetuoan2:/usr/lib/postgresql/9.4/bin$ ls
clusterdb initdb pg_ctl pg_restore postmaster
createdb oid2name pg_dump pg_standby psql
createlang pg_archivecleanup pg_dumpall pg_test_fsync reindexdb
createuser pg_basebackup pg_isready pg_test_timing vacuumdb
dropdb pgbench pg_receivexlog pg_upgrade vacuumlo
droplang pg_config pg_recvlogical pg_xlogdump
dropuser pg_controldata pg_resetxlog postgres
malikarumi@Tetuoan2:/usr/lib/postgresql/9.4/bin$
Best Answer
pg_ctl
by design isn't in the path of the version of PostgreSQL Debian (and therefore Ubuntu) distributes. PostgreSQL is installed as a service in Debian/UbuntuThat command calls an
init.d
script which wraps aroundpg_ctlcluster
. You can see that by opening/etc/init.d/postgresql
. You can callpg_ctlcluster
if you must.pg_ctrlcluster
is a perl script that wraps aroundpg_ctl
which isn't exposed (in the path) by design.pg_ctl
is technically distributed, but there is no reason to ever call it directly. To find it runYou can call
pg_ctl
explicitly with the full path, however don't.Also, going above and beyond and teaching you how to fish, you can always use
apropos
if you have these kind of questions later.