PostgreSQL, also known as Postgres, is a free and open-source relational Database management system emphasizing extensibility and SQL compliance.

Install on Ubuntu

sudo apt update && sudo apt install postgresql postgresql-contrib

CLI

To run as postgres user: To quit CLI use \q

sudo -u postgres psql

Create Database

Dump a table called ‘gbs’

su postgres -c 'createdb gbs'

Show Data in a table

su postgres -c 'SELECT * FROM <table>'

Dump Database

Dump a table called ‘gbs’

su postgres -c 'pg_dump gbs'