see postgres version code example
Example 1: check postgres version
psql --version
Example 2: check postgres version in ubuntu
$ locate bin/postgres
/usr/lib/postgresql/9.3/bin/postgres
psql --version
$ locate bin/postgres
/usr/lib/postgresql/9.3/bin/postgres