fbpx

How to Fix Pg_ctl command not found

Sometimes after a fresh PostgreSQL install if we want to start or stop from PostgreSQL rather than controlling the PostgreSQL instance start and stop from the root. And when we run the pg_ctl from the command prompt as a PostgreSQL Linux user we see the error bash: pg_ctl: command not found… 

In this article, lets learn how to fix it

As PostgreSQL check your pg base directory 

 

And now add this PostgreSQL to the Linux path so that it’s always available. I would recommand to create a postgresql env. file so that it more easy to handle rather than messing with other systems runing on linux operating system.

				
					--Step 1 
-bash-4.2$ echo $PGDATA
/var/lib/pgsql/10/data

--Step 2
-bash-4.2$ echo "PATH=/usr/pgsql-10/bin:$PATH">>~/.postgre_10.profile

--Step 3
chmod 777 .postgre_10.profile

--Step 4 
. .postgre_10.profile

--Step 5
Check pg_ctl now

-bash-4.2$ pg_ctl --version
pg_ctl (PostgreSQL) 10.17
-bash-4.2$



				
			

Share:

Facebook
Twitter
Pinterest
LinkedIn

Social Media

Most Popular

Get The Latest Updates

Subscribe To Our Weekly Newsletter

No spam, notifications only about new products, updates.

Categories