You get this error because you are you using systemctl when you did not install Postgres as a system service. Since you installed from source code you have to navigate into your Postgres directory and run bin/pg_ctl status -D /path/to/data_directory to ascertain the status of your Postgres instance.
You are getting this error because sudo is not in path,
Everything is a file in linux system, even commands as well.
You can check content of PATH variable by executing command $ echo $PATH
If you do not find /usr/bin in the output than you can append /usr/bin in PATH variable by executing command
export PATH=$PATH:/usr/bin
because sudo file is located in 2 places, i.e /usr/bin or /bin directories.
It’s happening because of some missing line in .bashrc file or which ever shell you are using, you can check that by echo $SHELL
Just add the export line in your respective shell config file and it’ll be permanent solution.
3
Answers
You get this error because you are you using
systemctl
when you did not install Postgres as a system service. Since you installed from source code you have to navigate into your Postgres directory and runbin/pg_ctl status -D /path/to/data_directory
to ascertain the status of your Postgres instance.Since
sudo
is looking is trying to locate/bin:usr/bin
in PATH, you can try exporting this in the PATH environment variable.Note: If you want to make this change permanent, try adding it at the end of
~/.bashrc
file and then saving the changes usingsource ~/.bashrc
.You are getting this error because
sudo
is not in path,Everything is a file in linux system, even commands as well.
You can check content of PATH variable by executing command $ echo $PATH
If you do not find /usr/bin in the output than you can append /usr/bin in PATH variable by executing command
export PATH=$PATH:/usr/bin
because
sudo
file is located in 2 places, i.e/usr/bin or /bin
directories.It’s happening because of some missing line in
.bashrc
file or which ever shell you are using, you can check that byecho $SHELL
Just add the export line in your respective shell config file and it’ll be permanent solution.
For Reference see this answer on AskUbuntu.