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:
Why just clear screen? Why not a toolbar where common commands can be added as quick shortcuts?
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.
Are we not talking about the same thing as issue # 1189 ?
@fzed51 Nope, this is unrelated to that one.
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.
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
You should definitely read the comments here. Because of the windows console infrastructure we鈥檙e built on it鈥檚 not quite that easy.
Ok, I don't have any idea about the internals of the terminal, however, if in order to clear a buffer after press a key combination is so complex probably it will be impossible to scale the product when adding more complex stuff than this
It's just this issue in particular that's thornier than most. For compatibility with Windows console applications that do _not_ expect a terminal to be connected, we need to maintain a text buffer for them to read. That's all. Because we don't have a way to clear that text buffer (from the terminal side), and we just haven't written one yet, it's only more complex than clearing the local screen. It's not a complexity class issue with all of Terminal.
Gotcha, thanks for the clarification, definitely isn't a beginners task
I'm discovering this while switching to this terminal and this is really annoying.
I was previously using cls to clear not only the screen but also the history, when you are using the same terminal for hours, and you are running commands that can generate errors, scrolling back is making things very difficult to spot which command is failing (when the errors can span on several pages), the sensitivity of the scroll is making too easy to scroll back to a previous command without noticing.
So big 馃憤 for a keystroke as I understand that cls is not meant for the history.
Thinking about it, also, as a nice improvement, maybe it is something that has a feature request on its own, but a "bird-view" side pane on the right side where we could spot easily where commands are and where are the outputs would be also super useful...
Don鈥檛 do that. It emails every subscriber to this issue or to this repository. We know that you want this fixed, somebody just needs to do the work.
@prumbles
If you are running WSL2, you can run:
tput clear
This does reset the terminal buffer fully without scrollback.
@prumbles
If you are running WSL2, you can run:
tput clear
This does reset the terminal buffer fully without scrollback.
both tput clear and celar can't clear while the process is outputing texts to the screen
I want a hotkey to clear the buffer. like ctrl+K in the macOS terminal
So find seems be there with ctrl+shift+F, hopefully we will get the ctrl+shift+K soon
I upvote the need
This is really a needed a feature while I am running logcat on an android device and want to start seeing the log when I start my app
@microsoftopensource please prioritize this.
Adding my support for this feature!
All related issues are being closed by admins by mentioning this one, but there is no activity on this issue,
@microsoftopensource @zadjii-msft How to prioritize this development?
If you want to help prioritize this feature, you can hit that 馃憤 button on the OP, which will avoid sending an unnecessary ping to everyone that's subscribed to this thread 馃槈

On my terminal, it worked by input tput reset
But tput clear did not work.
Most helpful comment
@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.