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:
- macOS: Press
Cmd + Kwhile the terminal is in focus. - Windows / Linux: There is no default shortcut
assigned to clear the terminal, but you can use
Ctrl + Kin some shell configurations, or set up a custom shortcut (see section 4).
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:
- PowerShell (Windows): Type
clearorcls - Command Prompt (Windows): Type
cls - Bash / Zsh (macOS & Linux): Type
clearor pressCtrl + L
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:
- Click inside the terminal to ensure it is in focus.
- Open the Command Palette using
Ctrl + Shift + P(Windows/Linux) orCmd + Shift + P(macOS). - 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:
- Open the Keyboard Shortcuts menu by pressing
Ctrl + K Ctrl + S(Windows/Linux) orCmd + K Cmd + S(macOS). - In the search bar at the top, type
workbench.action.terminal.clear. - Double-click the result labeled Terminal: Clear.
- Press the key combination you want to use (for example,
Ctrl + Kon Windows) and pressEnterto save it.