Where is a postgresql 9.1 database stored in ubuntu 12.04?

The postgres.conf file is located here: /etc/postgresql/9.1/main/postgres.conf. In postgres.conf can see a line stating data_directory=<path>

This is the directory where your database files are stored

Alternatively when you are connected to database use

SHOW data_directory

or

pg_lsclusters

to show the directory where your data is stored.

Hope this helps


ps auxw|grep postgres|grep -- -D  

returns:

/usr/lib/postgresql/9.3/bin/postgres -D /var/lib/postgresql/9.3/main 
-c config_file=/etc/postgresql/9.3/main/postgresql.conf

on Ubuntu 14.04. That command will work on other variants like Fedora