# Getting more out of psql (The PostgreSQL CLI)

DevFeed: [Getting more out of psql (The PostgreSQL CLI)](<https://devfeed.tech/articles/getting-more-out-of-psql-the-postgresql-cli-41127.md>)

Original publisher: [Read original article](<https://www.craigkerstiens.com/2013/02/21/more-out-of-psql/>)

Author: Map

Published: 2013-02-21T20:55:56Z

Content type: tutorial

Language: en

Sources: [Craig Kerstiens](<https://devfeed.tech/sources/craig-kerstiens.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Command-line interface](<https://devfeed.tech/topics/cli.md>), [Environment Variables](<https://devfeed.tech/topics/environment-variables.md>), [Terminal](<https://devfeed.tech/topics/terminal.md>), [GUI](<https://devfeed.tech/topics/gui.md>)

Tags: [cli](<https://devfeed.tech/tags/cli.md>), [database](<https://devfeed.tech/tags/database.md>), [environment-variables](<https://devfeed.tech/tags/environment-variables.md>), [gui](<https://devfeed.tech/tags/gui.md>), [postgres](<https://devfeed.tech/tags/postgres.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [psql](<https://devfeed.tech/tags/psql.md>), [terminal](<https://devfeed.tech/tags/terminal.md>)

## AI overview

A tutorial on customizing PostgreSQL's psql command-line client. It covers terminal presentation, environment variables, prompt colors, query timing, pager settings, configuration files, and aliases.

## Source excerpt

After my last post I had a variety of readers reach out about many different tweaks they'd made to their workflows using with psql. One people Grégoire Hubert had a wondeful extensive list of items. Grégoire has been a freelance in web development and he has worked with Postgresql for some time now in addition to being the author of Pomm. Without further ado heres what he has to say on how he uses psql: Get the most of psql Psql, the CLI postgreSQL client, is a powerful tool. Sadly, lot of developers are not aware of the features and instead look for a GUI to provide what they need. Let's fly over what can psql do for you. Feel yourself at home One of the most common misconception people have about CLI is "They are a poor user interface". C'mon, the CLI is the most efficient user interface ever. There is nothing to disturb you from what you are doing and you are by far fastest without switching to your mouse all the time. Let's see how we can configure psql at our convenience. First, you'll have managed to choose a nice and fancy terminal font like monofur or inconsolata. Do not underestimate the power of the font The nice line style shown above can be set with \pset linestyle unicode and \pset border 2. This is just an example of the many environment variables you can play with to get your preferred style of working out of psql. For example, I found the character ¤ the most accurate to express nullity (instead of default NULL). Let's just \pset null ¤ and here it is: SELECT * FROM very_interesting_stat; ┌──────┬──────┬──────┬──────┬──────┐ │ a │ b │ c │ d │ e │ ├──────┼──────┼──────┼──────┼──────┤ │ 9.06 │ ¤ │ ¤ │ ¤ │ ¤ │ │ 7.30 │ 3.55 │ 7.57 │ 3.31 │ ¤ │ │ 7.20 │ 5.08 │ ¤ │ 6.58 │ 5.90 │ ... Another hugely value to get environment variables is colors in the prompt. Colors in the prompt are important because it makes easier to spot where output starts and ends between two interactions at the console. The PROMPT1 environment variable will even let you set an indicat