postgresql-cli
PostgreSQL interactive terminal (psql) reference and usage guide.
psql — PostgreSQL Interactive Terminal
psql is PostgreSQL's feature-rich interactive terminal. It lets you write and execute queries, inspect database objects, import/export data, script batch operations, and customize output formatting — all from the command line.
Prerequisites
Before using psql, verify it is installed and available:
# Check if psql is installed
psql --version
# If not found, install PostgreSQL client tools:
# macOS (Homebrew)
brew install libpq
brew link --force libpq
# Ubuntu / Debian
sudo apt install postgresql-client
# CentOS / RHEL
sudo yum install postgresql
# Alpine
apk add postgresql-client
# Windows — install PostgreSQL via the official installer or use WSL
psql ships as part of the postgresql-client package. The server (postgresql) is not required — you only need the client to connect to a remote PostgreSQL instance.
Quick Reference
Connecting
# 1. CLI flags
psql -h host -p port -U user -d dbname
# 2. Connection URI
# WARNING: Password in URI is visible in shell history and process listings.
# Prefer ~/.pgpass for production use (see method 4 below).
psql "postgresql://user:YOUR_PASSWORD@host:port/dbname"
# 3. Environment variables (no flags needed)
export PGHOST=localhost
export PGPORT=5432
export PGDATABASE=mydb
export PGUSER=postgres
# WARNING: PGPASSWORD is visible in process listings (e.gSubscribers only
The full skill, its 7 bundled files and every download is included with every paid Complete AI plan.
Details
| Source | chaunsin/agent-skills |
|---|---|
| License | Apache-2.0 |
| Risk label | critical ("critical" means the skill may run commands or touch files — read before use) |
| Files | SKILL.md, references/cli-options-and-variables.md, references/meta-commands-core.md, references/meta-commands-formatting.md, references/meta-commands-inspection.md, references/tips-advanced.md, references/tips-workflows.md |
| Added | 2026-07-01 |
Related skills
database-cloud-optimization-cost-optimize
You are a cloud cost optimization expert specializing in reducing infrastructure expenses while maintaining performance and reliability. Analyze cloud spending, identify savings opportunities, and implement cost-effective architectures across AWS, Azure, and GCP.
database-migration
Master database schema and data migrations across ORMs (Sequelize, TypeORM, Prisma), including rollback strategies and zero-downtime deployments.
database-migrations-migration-observability
Migration monitoring, CDC, and observability infrastructure
database-migrations-sql-migrations
SQL database migrations with zero-downtime strategies for PostgreSQL, MySQL, and SQL Server. Focus on data integrity and rollback plans.
database-security
Authorized database security assessment across PostgreSQL, MySQL, MSSQL, MongoDB, and Redis: exposure, authorization gaps, UDF/command execution paths, and misconfiguration review.
drizzle-migration-conflict
Diagnose, repair, and prevent Drizzle Kit migration conflicts involving generated SQL, snapshots, journals, merge queues, and team workflows.
