Skip to content

Add a terminal-side shortcut for clearing the screen and/or scrollback #1882

Closed

Description

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

Activity

  1. ghost added
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    on Jul 8, 2019
  2. ghost added
    Needs-Tag-FixDoesn't match tag requirements
    on Jul 8, 2019
  3. mdtauk commented on Jul 8, 2019

    @mdtauk

    Why just clear screen? Why not a toolbar where common commands can be added as quick shortcuts?

  4. prumbles commented on Jul 8, 2019

    @prumbles
    Author

    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.

  5. fzed51 commented on Jul 11, 2019

    @fzed51

    Are we not talking about the same thing as issue # 1189 ?

  6. zadjii-msft commented on Jul 11, 2019

    @zadjii-msft
    Member

    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 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.

  7. added
    Area-TerminalControlIssues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)
    Issue-TaskIt's a feature request, but it doesn't really need a major design.
    on Jul 11, 2019
  8. ghost removed
    Needs-Tag-FixDoesn't match tag requirements
    on Jul 11, 2019
  9. changed the title [-]Clear screen shortcut[/-] [+]Add a terminal-side shortcut for clearing the screen and/or scrollback[/+] on Jul 15, 2019
  10. eduardonunesp commented on Jan 7, 2020

    @eduardonunesp

    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

  11. DHowett-MSFT commented on Jan 7, 2020

    @DHowett-MSFT
    Contributor

    You should definitely read the comments here. Because of the windows console infrastructure we’re built on it’s not quite that easy.

  12. 16 remaining items

  13. tommiv commented on Mar 24, 2021

    @tommiv

    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.

  14. chilipepper987 commented on Jun 13, 2021

    @chilipepper987

    Any updates on this? Still annoying that there is no clear scrollback option. That's the only thing stopping me from uninstalling MobaXTerm

  15. astraw commented on Jun 13, 2021

    @astraw

    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).

  16. added a commit that references this issue on Jul 29, 2021
  17. zadjii-msft commented on Jul 29, 2021

    @zadjii-msft
    Member

    There are other details in #1193 for those interested in the technical bits.

    For everyone else who's just here for results:
    clear-buffer-000

  18. VanilsonFernandes commented on Jul 30, 2021

    @VanilsonFernandes

    There are other details in #1193 for those interested in the technical bits.

    For everyone else who's just here for results:
    clear-buffer-000

    Nice work! This works while running a "ping google.com -t"?

    Thanks

  19. ghost added
    In-PRThis issue has a related PR
    on Aug 9, 2021
  20. ghost closed this as completedin #10906on Sep 2, 2021
  21. ghost added a commit that references this issue on Sep 2, 2021
    6268a47
  22. ghost removed
    In-PRThis issue has a related PR
    on Sep 2, 2021
  23. ghost added
    Resolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.
    on Sep 2, 2021
  24. KaoruDev commented on Sep 21, 2021

    @KaoruDev

    I'm sort of confused, I'm hitting ctrl+shift+p to pull up the command menu, but I can't seem to find Clear buffer? I'm on version: 1.10.2383.0

  25. DHowett commented on Sep 21, 2021

    @DHowett
    Member

    1.12 should be the first version that has this feature.

  26. KaoruDev commented on Sep 21, 2021

    @KaoruDev

    1.12 should be the first version that has this feature.

    ah got it, thank you! can't wait!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-TerminalControlIssues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)Issue-TaskIt's a feature request, but it doesn't really need a major design.Product-TerminalThe new Windows Terminal.Resolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions