keystroke to clear screen in psql?

rferrisx picture rferrisx · Sep 26, 2014 · Viewed 27.8k times · Source

I want a shortcut key to clear the screen in my (Windows 7) psql console just like CTRL-l clears the screen in my R console. I am tired of typing '! cls'. Do I need to write a macro for this? I am running Postgres 9.35. '\r' resets the query buffer but does not clear the screen. Thanks in advance for your help, sorry if I have just missed something simple.

Answer

Hartmut P. picture Hartmut P. · Jul 23, 2015

As an alternative to Ctrl-L use, e.g. for scripts in an linux environment:

\! clear

or

\! cls

for Microsoft.