connect to postgresql command line code example
Example 1: access the postgres psql
psql -h localhost -U username databasename
Example 2: postgresql connect to database command line
user@user-pc:~$ sudo -i -u postgres
postgres@user-pc:~$ psql
psql (9.3.5, server 9.3.6)
Type "help" for help.