Getting A New Anvil From The Past

Umut Tekin
2 min readMar 13, 2023

--

If you do not use a database client tool like TOAD or pgAdmin to connect database, then probably you use command line tools. Sometimes, you don’ t have any other choices to connect a database, but using the command line tools or maybe, you have prepared/predefined scripts that can be simply executed by using a command line interface.

Today, I want to show you a new feature of “less” command in Linux based operating systems. It is a new feature for me, but it has already been with the “less ” for many years.

There is no terminal that natively supports horizontal scrollling in the most of Linux based operating systems. Either, you have to edit the environment variables/text editor configurations or you have to use terminator. When you use Windows you have one other option which is plain, old command prompt. Yet, be careful! Because, it is not terminal which has been recently released. With a few configuration change on Windows command prompt you can get horizontal scrolling. If you want to have horizontal scrolling on the terminal you need to get another third party solution, vtm.

When using custom scripts like Ferhat Sengonul’ s or Tanel Poder’ s, I have to use aforementioned solutions. Otherwise, we might get something like this:

With the right tool and correct configuration the Oracle’ s “sqlplus” can give you this output:

This is fine, but do we have this feature in PostgreSQL’ s “psql”? Because, to get an output like this we have format columns, but PostgreSQL does not provide such an option.

At the end of my search, depesz, himself helped me to enable horizontal scrolling for psql through his blog.

Our initial output in “psql” is:

This output with two environment variables turns into:

and you can scroll horizontally using left and right arrow keys.

I hope you will find it useful.

Thanks for reading!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response