0

I found my psql folder typing :

$ which psql
/usr/bin/psql

But when I Tried get in I got this:

where I am:

root@localhost:/usr/bin#
$ cd psql
-bash: cd: psql: Not a directory

I can see the folder is there but i can't access, I am using Root User.

  • please, specify exactly what you are looking for : ) – lese Oct 13 '15 at 12:17
1

In fact it's not a directory, it is a symlink:

# ls -la psql 
lrwxrwxrwx. 1 root root 28 Jul 23 14:38 psql -> /etc/alternatives/pgsql-psql

that point to an other symlink:

ls -la  /etc/alternatives/pgsql-psql
lrwxrwxrwx. 1 root root 23 Jul 23 14:38 /etc/alternatives/pgsql-psql -> /usr/pgsql-9.1/bin/psql

that in the end, it is an executable file

# ls -la /usr/pgsql-9.1/bin/psql
-rwxr-xr-x. 1 root root 425192 Jun 11 14:51 /usr/pgsql-9.1/bin/psql

Exactly what you are looking for? I just guess that you are looking for postgres home folder, you can find it as follow:

# become the user postgres
su postgres
# change directory to the postgres home folder
cd ~

In my case, this folder is located in /var/lib/pgsql as you can see:

bash-4.1$ pwd
/var/lib/pgsql
  • yes it is :), very nice explanation about symlink, I was looking for my database backup and someone told me will be there and I found : /var/lib/postgresql# – raduken Oct 13 '15 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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