skip to Main Content

I have installed the new postgresql-12 on my ubuntu 22 and set the path but when I want to know the postgrsql status it is giving me this Error.

Can anyone help me with that?
Error Image

Thank you.

3

Answers


  1. 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.

    Login or Signup to reply.
  2. Since sudo is looking is trying to locate /bin:usr/bin in PATH, you can try exporting this in the PATH environment variable.

    export PATH=$PATH:/bin:/usr/bin
    

    Note: If you want to make this change permanent, try adding it at the end of ~/.bashrc file and then saving the changes using source ~/.bashrc.

    Login or Signup to reply.
  3. 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.

    For Reference see this answer on AskUbuntu.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search