Did I Already Install Postgres?

1. Check if the psql client exists
psql --version
If installed, you’ll see something like:
psql (PostgreSQL) 15.3
If not installed:
command not found
2. Check if the postgres service exists
systemctl status postgresql
- If installed + running → you’ll see
active (running) - If installed but stopped →
inactive - If not installed → “Unit postgresql.service could not be found”
3. Check installed packages (more definitive)
dpkg -l | grep postgres
This will list anything like:
postgresql
postgresql-15
postgresql-client-15
👉 This is the most reliable “is it installed at all” check.
4. Check if the binary exists directly
which psql
- If installed →
/usr/bin/psql - If not → no output
5. Bonus: check if a server is actually running
pg_isready
- If running →
accepting connections - If not →
no response
Quick mental model (very you-friendly)
psql→ “can I talk to postgres?”systemctl→ “is postgres running as a service?”dpkg→ “is postgres installed at all?”