psql interactive terminal

Updated: 08 May 2026

interactive

Start interactive session

psql -U the_user

Show all databases in the current server

\l+

non-interactive

Run a SQL file from the command line

psql -U username -d dbname -f our-db-backup.sql

Run a SQL statement from the command line

psql -U username -d dbname -c 'SELECT 101'

Leave a comment