LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

pgcli

enhanced PostgreSQL client with auto-completion and syntax highlighting

TLDR

Connect to database
$ pgcli [database]
copy
Connect with user and host
$ pgcli -h [hostname] -u [user] [database]
copy
Connect with URL
$ pgcli postgresql://[user]:[password]@[host]/[database]
copy
Connect via socket
$ pgcli -h /var/run/postgresql [database]
copy
Run single query
$ pgcli -c "[SELECT * FROM table]" [database]
copy
Execute file
$ pgcli [database] < [script.sql]
copy
List databases
$ pgcli --list
copy

SYNOPSIS

pgcli [-h host] [-p port] [-u user] [-c command] [options] [database]

DESCRIPTION

pgcli is an enhanced PostgreSQL client with auto-completion and syntax highlighting. It provides a more user-friendly experience than psql.Auto-completion suggests table names, column names, SQL keywords, and function names as you type. Context-aware suggestions understand joins, subqueries, and complex expressions.Syntax highlighting makes queries more readable. Errors in SQL are visible before execution.Multi-line editing supports complex queries. History search finds previous commands. Output can be saved to files.The interface responds to psql backslash commands (\d, \dt, \l, etc.) for compatibility. Additional commands are available for pgcli-specific features.Configuration controls colors, key bindings, and behavior. The pgclirc file customizes the environment.

PARAMETERS

-h HOST, --host HOST

Database server host.
-p PORT, --port PORT
Database port.
-u USER, --user USER
Username.
-W, --password
Prompt for password.
-d DB, --dbname DB
Database name.
-c CMD
Execute command and exit.
--list
List databases.
--auto-vertical-output
Automatic vertical display for wide output.
--row-limit N
Limit displayed rows.
-l, --log-file FILE
Log to file.
--pgclirc FILE
Config file path.
--version
Show version.

INSTALL

sudo dnf install pgcli
copy
sudo pacman -S pgcli
copy
sudo apk add pgcli
copy
brew install pgcli
copy
nix profile install nixpkgs#pgcli
copy

CAVEATS

Requires Python. Some psql features not implemented. Large result sets may be slow to display.

HISTORY

pgcli was created by Amjith Ramanujam around 2014, inspired by mycli for MySQL. It brought modern CLI features to PostgreSQL, emphasizing usability improvements over the basic psql client.

SEE ALSO

psql(1), mycli(1), litecli(1), pg_dump(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid