How to clear the entire terminal (PowerShell) How to clear the entire terminal (PowerShell) powershell powershell

How to clear the entire terminal (PowerShell)


To also clear the scrollback buffer, not just the visible portion of the terminal in Visual Studio Code's integrated terminal, use one of the following methods:

  • Use the command palette:

    • Press Ctrl+Shift+P and type tclear to match the Terminal: Clear command and press Enter
  • Use the integrated terminal's context menu:

    • Right-click in the terminal and select Clear from the context menu.
    • On Windows, you may have to enable the integrated terminal's context menu first, given that by default right-clicking pastes text from the clipboard:
      Open the settings (Ctrl+,) and change setting terminal.integrated.rightClickBehavior to either default or selectWord (the latter selects the word under the cursor before showing the context menu).
  • Use a keybord shortcut from inside the integrated terminal:

    • On Windows, use Ctrl+K, the default.
    • As of VSCode 1.30.1, on macOS, a default exists, Cmd+K, but doesn't work, whereas on Linux there is no default at all.
      The solution in both cases is to define a custom key binding as follows, by directly editing file keybindings.json (command Preferences: Open Keyboard Shortcuts File from the command palette):
{  "key": "ctrl+k", // on macOS, alternatively use "cmd+k"  "command": "workbench.action.terminal.clear",  "when": "terminalFocus" // To avoid conflicts with Ctrl+K *chords* elsewhere}