Skip to content

Quick Start

Get up and running with pg in 5 minutes!

1. Install pg

RPM (Fedora/RHEL/CentOS):

# Download and install
curl -L "https://gitlab.com/l_avrot/pg-lord-of-the-rings/-/packages/generic/pglord/v1.1/pglord-1.1-1.fc41.noarch.rpm" -o pglord.rpm
sudo dnf install ./pglord.rpm

DEB (Debian/Ubuntu):

# Download and install
curl -L "https://gitlab.com/l_avrot/pg-lord-of-the-rings/-/packages/generic/pglord/v1.1/pglord_1.1-1_all.deb" -o pglord.deb
sudo dpkg -i pglord.deb

See the Installation page for other ways to install.

Create ~/.pg_service.conf:

[dev]
host=localhost
port=5432
user=myuser
dbname=myapp

[production]
host=prod-db.company.com
port=5432
user=app_user
dbname=myapp
sslmode=require

Why Service Files?

Service files keep credentials secure, commands clean, and make environment switching trivial.

3. Your First Commands

Connect to your database:

pg query -s dev

Export a database:

pg dump db -s dev -f dump.sql # or pg export db -s dev -f dump.sql

Create a new database:

pg create db -s dev testapp

Check server status:

pg info ready -s production # or pg ready -s production

4. Alternative Connection Methods

If you prefer individual flags:

pg query -d myapp -h localhost -u myuser -p 5432

Or use a connection string:

pg query -c "host=localhost user=myuser dbname=myapp"

5. Get Help Anytime

pg help                    # Full command reference
pg dump --help             # Help for dump command
pg query --pg-verbose      # Debug mode for troubleshooting
pg dump db --help          # Help for the underlying Postgres tool (here pg_dump)
man pg                     # Complete manual page

What's Next?


🎉 You're ready to go! Start with pg query and explore from there.