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.
keystroke to clear screen in psql?
Asked Answered
As an alternative to Ctrl-L use, e.g. for scripts in an linux environment:
\! clear
or
\! cls
for Microsoft.
Please use: CTRL + L
Check out the link: http://postgresql.nabble.com/psql-in-bash-how-to-clear-screen-td2141886.html
I'm on Postgres 11.5 on Windows 10 and this doesn't work. It just adds
^L
on the line –
Cabriole I had the same issue. I got it working with CTRL + SHIFT + L instead. I am using Windows 7, postgresql 12. –
Daman
Works on Mac, too! –
Ruck
@Cabriole SEEMS Working on WSL Env. –
Suggestion
In case CTRL + L doesn't work on the Windows OS, use:
\! cls
Ensure there is SPACE
between \!
and cls
, hit ENTER
.
This works for me using postgresql in Windows 10 with Bash:
\! clear
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. –
Beneficiary
Please read this to learn about Bash: opensource.com/resources/what-bash –
Forlorn
When using psql ((PostgreSQL) 14.4) through linux terminal just use:
CTRL + Shift + L
It will clear outputs and move cursor to the top of terminal window.
:)
If you're using WSL and a Docker Container, only works with:
\clear
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. –
Panada
© 2022 - 2024 — McMap. All rights reserved.
psql
on Linux, control-L . It isn't supported under Windows; unsure if there's a different keyboard shortcut or if there just isn't one.psql
isn't as full featured under Windows because none of the PostgreSQL developers use Windows for day to day work. Patches are welcome ;-) – Discomfiture\! cls
to clear screen. Generally, use\! command
to invoke command from current console (cmd.exe). – PhyllisphyllocladeCTRL + SHIFT + L
doesn't seem to work on Windows 10 [Pro]. I tried it on Postgres 12.4 and it didn't work.\! cls
works great! – Franciscafranciscan