How to Clear Terminal in VS Code

This article provides a quick and straightforward guide on how to clear the integrated terminal screen in Visual Studio Code (VS Code). You will learn the default keyboard shortcuts for different operating systems, the standard shell commands, and how to set up a custom keybinding to clear your terminal instantly.

1. Use Keyboard Shortcuts

The quickest way to clear your terminal is by using a keyboard shortcut. The default shortcuts vary by operating system:

2. Use Shell Commands

You can clear the screen by typing a command directly into the terminal and pressing Enter. The command depends on the shell you are using:

3. Use the Command Palette

If you do not want to use a shortcut or type a command, you can use the VS Code Command Palette:

  1. Click inside the terminal to ensure it is in focus.
  2. Open the Command Palette using Ctrl + Shift + P (Windows/Linux) or Cmd + Shift + P (macOS).
  3. Type Terminal: Clear and press Enter.

4. Set a Custom Keyboard Shortcut

To create a custom keybinding to clear the terminal on any operating system, follow these steps:

  1. Open the Keyboard Shortcuts menu by pressing Ctrl + K Ctrl + S (Windows/Linux) or Cmd + K Cmd + S (macOS).
  2. In the search bar at the top, type workbench.action.terminal.clear.
  3. Double-click the result labeled Terminal: Clear.
  4. Press the key combination you want to use (for example, Ctrl + K on Windows) and press Enter to save it.