2024-02-13
Installation
$ sudo apt install postgresql
Become the postgres user.
$ su -l postgres
[Optional] Create User
$ createuser --interactive
[Optional] Create Database
$ createdb DBNAME
Start the primary database shell.
$ psql
List all databases
=> \l
Connect to a particular database:
=> \c DBNAME
Show summary information about all tables in the current database:
=> \dt
List all users and their permission levels:
=> \du
Exit/quit the psql
shell:
=> \q
Clear shell output
=> \! clear
PostgreSQL interprets " as being quotes for identifiers, ' as being quotes for strings.