When you’re deep in a PostgreSQL incident, you don’t have time for clunky tools or guesswork. You need a direct, reliable way to query data and tunnel connections with zero friction. That’s where using pgcli and socat together becomes the fastest path from stuck to solved.
pgcli is a terminal-based PostgreSQL client that beats the default psql with smart auto-completion, syntax highlighting, and a clean interface. It makes reading large queries easier and writing them faster. When paired with socat, a simple yet powerful utility for creating bidirectional data streams, you can securely channel database traffic through any port or socket you choose.
Here’s a setup that works in seconds. Open your terminal and use socat to forward traffic from a local port to your remote Postgres instance, even through restricted network paths. Once the tunnel is live, fire up pgcli and connect using the forwarded port. No manual network reconfiguration. No heavy SSH clients. Just you, your queries, and a fast, stable connection.