Skip to content

CLI Reference

Terminal window
pgxcli [DBNAME] [USERNAME] [flags]

Host address of the PostgreSQL database.

  • Type: string
  • Default: localhost

Port number for the PostgreSQL server.

  • Type: integer
  • Default: 5432

Username to connect as.

  • Type: string
  • Required: Yes (unless provided as positional argument)

Database name to connect to.

  • Type: string
  • Required: Yes (unless provided as positional argument)

Force password prompt before connecting.

  • Type: boolean
  • Default: false

Never prompt for password.

  • Type: boolean
  • Default: false

Enable debug mode for verbose logging.

  • Type: boolean
  • Default: false

Show help message and exit.

Inside the interactive REPL, you can use PostgreSQL special commands:

  • \d [pattern] - List tables, views, and sequences
  • \l - List databases
  • \dt - List tables only
  • \q - Quit the application
  • And many more standard PostgreSQL backslash commands

You can use standard PostgreSQL environment variables:

  • PGHOST - Database host
  • PGPORT - Database port
  • PGUSER - Database user
  • PGDATABASE - Database name
  • PGPASSWORD - Database password (not recommended for security reasons)