check postgres version in ubuntu

C++
psql --version$ locate bin/postgres
/usr/lib/postgresql/9.3/bin/postgres

Source

Also in C++: