psql -d appdb -x -c 'SELECT * FROM users;'

Category: Databases & SQL

psql -d appdb -x -c 'SELECT * FROM users;'

Query with one column per line

-x enables expanded output so wide rows print one column per line instead of wrapping. Much easier to read for tables with many columns or long text values. The \x meta-command toggles the same behavior interactively.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.