psql
TLDR
Connect to database
$ psql -d [database]
Connect to remote server$ psql -h [host] -U [user] -d [database]
Execute SQL command$ psql -c "SELECT * FROM [table]" [database]
Execute SQL file$ psql -f [script.sql] [database]
List databases$ psql -l
Interactive mode$ psql [database]
SYNOPSIS
psql [options] [dbname]
DESCRIPTION
psql is PostgreSQL interactive terminal. Database client.
The tool executes SQL queries. Manages PostgreSQL databases.
psql queries PostgreSQL.
PARAMETERS
DBNAME
Database name.-h HOST
Server hostname.-p PORT
Port number.-U USER
Username.-d DBNAME
Database name.-c COMMAND
Execute command.-f FILE
Execute file.-l
List databases.
CAVEATS
PostgreSQL specific. Requires server connection.
HISTORY
psql is the official PostgreSQL command-line client.


