Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Is there some setting or package that I could use to give syntax highlighting to psql (the PostgreSQL shell)?

share|improve this question
Shouldn't this be a stackoverflow question? In any case I'm also looking for coloured display of psql results or help files, e.g. for \h select – nikola Nov 1 '13 at 14:55

2 Answers 2

up vote 1 down vote accepted

I just found pgcli ( — a postgres client that does auto-completion and syntax highlighting. It looks awesome!

pgcli in action

Quick Start

If you already know how to install python packages, then you can simply do:

$ pip install pgcli


$ brew install pgcli  # Only on OS X

If you don't know how to install python packages, please check the detailed instructions.


$ pgcli [database_name]


$ pgcli postgresql://[user[:password]@][netloc][:port][/dbname] 


$ pgcli local_database

$ pgcli postgres://amjith:pa$$


share|improve this answer
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Pilot6 Oct 21 at 13:59
@Pilot6 Thanks for pointing it out, added image and more specific info. – honza-kasik Oct 23 at 6:09

Any particular editor? Vim syntax file psql (Tutorial for installing).

share|improve this answer
I want the syntax highlighting in theshell not in a editor – tutuca May 10 '11 at 22:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.