"Main" folder is not found at "/var/lib/postgresql/9.3/" I am new to Ubuntu and PostgreSQL. I am trying to find a "data directory" for PostgreSQL on my Ubuntu.
When I Googled, it appears that it should be /var/lib/postgresql/9.3/main. But on my Ubuntu, I do not see that folder. 
 I only see "bin" and "lib" folders. Can anyone guide where I could locate a data directory for PostgreSQL?

I was informed that the variable is normally called datadir.
pg_conftool

Debian and Ubuntu provide their own utilities. To get this information, use pg_conftool. Here is what it looks like,

pg_conftool show -s data_directory;
/var/lib/postgresql/9.5/main


For reference,

Usage:
  /usr/bin/pg_conftool [options] [&lt;version&gt; &lt;cluster name&gt;] [&lt;configfile&gt;] &lt;command&gt;

Options:
  -b --boolean  Format output as boolean
  -s --short    Print only value
  -v --verbose  Verbose output
  --help        This help

Commands:
  show &lt;parameter&gt;|all
  set &lt;parameter&gt; &lt;value&gt;
  remove &lt;parameter&gt;
  edit


pg_lsclusters

If you're running multiple versions of PostgreSQL on the same machine, you may find pg_lsclusters useful. It will show you all of the versions running.

pg_lsclusters
Ver Cluster Port Status Owner    Data directory               Log file
9.5 main    5433 online postgres /var/lib/postgresql/9.5/main /var/log/postgresql/postgresql-9.5-main.log


You can parse that pretty easy, here we use awk to get out the Ver and Data directory,

pg_lsclusters | awk '{print $1,$6}'
Ver Data
9.5 /var/lib/postgresql/9.5/main


If you have JSON.pm installed you can use pg_lsclusters -j to output JSON,

Error: Please install JSON.pm for JSON output (Debian: libjson-perl)