Forrest logo
back to context overview

psql

List of commands for psql:

  • psql:tldr:7978b psql: Execute commands from a file on the given database.
    $ psql ${database} -f ${file-sql}
    try on your machine
    explain this command
  • psql:tldr:83e3a psql: Connect to the database; user will be prompted for password.
    $ psql -h ${host} -p ${port} -U ${username} -W ${database}
    try on your machine
    explain this command
  • psql:tldr:ad719 psql: Connect to the database. By default, it connects to the local socket using port 5432 with the currently logged in user.
    $ psql ${database}
    try on your machine
    explain this command
  • psql:tldr:afdb1 psql: Connect to the database on given server host running on given port with given username, without a password prompt.
    $ psql -h ${host} -p ${port} -U ${username} ${database}
    try on your machine
    explain this command
  • psql:tldr:f813c psql: Execute a single SQL query or PostgreSQL command on the given database (useful in shell scripts).
    $ psql -c '${query}' ${database}
    try on your machine
    explain this command
back to context overview