You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a terminal-side shortcut for clearing the screen and/or scrollback #1882
It would be great to have the equivalent of Command+K on the Mac terminal. This clears the terminal completely, not the equivalent of typing "clear", which only scrolls the cursor to the top of the terminal. My use case is the following:
Open an Ubuntu terminal
ssh into a server
run a command which may produce large amounts of content and exceptions within the content
fix the exceptions by making a code change
CLEAR the terminal completely (not just a "clear" command)
re-run the command
now that the previous command output was cleared, we can search for new exceptions without getting the previous exceptions
NOTE: this also requires a "ctrl+F" type feature to exist in the terminal, which currently does not
Reacted by Dustin Dahl, Frozenex, Jo Kachikaran, Dražen Tenžera, Amos Anderson, Lemmingh, Eduardo Pereira, Michael Solomon, leon740727, Rahul Thakare and 148 more
Reacted by KytoSai, Chris Feijoo, Tom McKinney, Victor Yudin, Keith Smith, Artem Russkikh, Dien Bui, Filip Bugaj, Eduardo Pereira, Edoardo Ceccarelli and 18 more
Reacted by Filip Bugaj, Henry Lee, AJ Otto, Dusan Slijepcevic, nelcab, Abror Khalilov, Özgün Ayaz, Lucas Kim and Wade Walker
But, this isn't a bash command, as I think that's what you are asking. Command+K on a mac doesn't run any commands in the terminal such as "clear"... it clears the entire terminal buffer. Commands such as "clear" don't do the equivalent. I personally don't need a toolbar - I'm fine with adding them to the "Settings.json" file like all the other keyboard shortcuts. Its just that "Clear terminal" is not one of the available options to create a shortcut for. If you use VSCode, the exact equivalent command is "Terminal:Clear". I map that to Alt+K to get the same experience.
Reacted by Fabien S., Rahul Thakare, Alexandre Lefebvre, Bartek Pacia, Xian Zhao, egeres, Mustafa, Tom McKinney, summerzzc, Kai Tamkun and 12 more
To clarify for future me - cmd+k is not something that's being handled by bash or the shell. This is the Terminal itself handling the keybinding, and clearing both the buffer and the scrollback.
You've described a user story that makes sense to me, so I'm gonna put this on the backlog.
Reacted by Peter Rumbles, solacens, Radu, Daniel, jelin1, Roger Senna, Dustin Dahl, Brett Beers, Conan, Lemmingh and 29 more
Reacted by Peter Rumbles, Brett Beers, Eduardo Pereira, Quinten Krijger, Simon Lang, odusseys, Jacob Burton, Arpit Jain, Michael Lah, Stanislav Goncharov and 1 more
Others have noted that the command cls is not a perfect solution but for me it has reduced the issue to background noise and I am happy to have rediscovered cls (after approximately 30+ years -- I think I used to use it in DOS if I remember correctly).
Activity
mdtauk commentedon Jul 8, 2019
Why just clear screen? Why not a toolbar where common commands can be added as quick shortcuts?
prumbles commentedon Jul 8, 2019
But, this isn't a bash command, as I think that's what you are asking. Command+K on a mac doesn't run any commands in the terminal such as "clear"... it clears the entire terminal buffer. Commands such as "clear" don't do the equivalent. I personally don't need a toolbar - I'm fine with adding them to the "Settings.json" file like all the other keyboard shortcuts. Its just that "Clear terminal" is not one of the available options to create a shortcut for. If you use VSCode, the exact equivalent command is "Terminal:Clear". I map that to Alt+K to get the same experience.
fzed51 commentedon Jul 11, 2019
Are we not talking about the same thing as issue # 1189 ?
zadjii-msft commentedon Jul 11, 2019
Fabien S. (@fzed51) Nope, this is unrelated to that one.
To clarify for future me - cmd+k is not something that's being handled by
bashor the shell. This is the Terminal itself handling the keybinding, and clearing both the buffer and the scrollback.You've described a user story that makes sense to me, so I'm gonna put this on the backlog.
[-]Clear screen shortcut[/-][+]Add a terminal-side shortcut for clearing the screen and/or scrollback[/+]eduardonunesp commentedon Jan 7, 2020
I would like to help with that if possible, shouldn't be so difficult right? I mean can be just reset the buffer and initialize again the buffer
DHowett-MSFT commentedon Jan 7, 2020
You should definitely read the comments here. Because of the windows console infrastructure we’re built on it’s not quite that easy.
16 remaining items
tommiv commentedon Mar 24, 2021
Second tab doesn't work for many cases. SSH sessions, tail -f, long CWD you don't want to type again and again – to start with.
chilipepper987 commentedon Jun 13, 2021
Any updates on this? Still annoying that there is no clear scrollback option. That's the only thing stopping me from uninstalling MobaXTerm
astraw commentedon Jun 13, 2021
Others have noted that the command
clsis not a perfect solution but for me it has reduced the issue to background noise and I am happy to have rediscoveredcls(after approximately 30+ years -- I think I used to use it in DOS if I remember correctly).This plumbs #1882 and #1193 all the way through.
zadjii-msft commentedon Jul 29, 2021
There are other details in #1193 for those interested in the technical bits.
For everyone else who's just here for results:

VanilsonFernandes commentedon Jul 30, 2021
Nice work! This works while running a "ping google.com -t"?
Thanks
Implement and action for manually clearing the Terminal (and conpty) …
KaoruDev commentedon Sep 21, 2021
I'm sort of confused, I'm hitting
ctrl+shift+pto pull up the command menu, but I can't seem to find Clear buffer? I'm on version:1.10.2383.0DHowett commentedon Sep 21, 2021
1.12 should be the first version that has this feature.
KaoruDev commentedon Sep 21, 2021
ah got it, thank you! can't wait!