psql Command Examples

PostgreSQL command-line client. More information: https://www.postgresql.org/docs/current/app-psql.html.

psql {{database}}

psql -h {{host}} -p {{port}} -U {{username}} {{database}}

psql -h {{host}} -p {{port}} -U {{username}} -W {{database}}

psql -c '{{query}}' {{database}}

psql {{database}} -f {{file.sql}}