You can use Ctrl+L keyboard shortcut in Linux to clear the screen. It works in most terminal emulators.
Use Ctrl+K. This goes clean your console in Visual Studio Code.
Per comments, in later versions of VSCode (1.29 and above) this shortcut is missing / needs to be created manually.
File
> Preferences
> Keyboard Shortcuts
workbench.action.terminal.clear
CTRL
and tap K
. Ctrl + K
should now be listed. Press enter to save this mappingChange when expression
. Type terminalFocus
then press enter.clear
/cls
.Ctrl + Shift + P and select Terminal:clear
FOR VERSIONS AT AND ABOVE
v1.32
SEE BELOW
Bindings for this command still need to be setup manually, even at v1.33.1
, which I am at. The command is there under Terminal: Clear
but the binding is blank. Here is how you can setup bindings in v1.32
and up.
Open up the Keyboard Shortcuts
with Ctrl+K, Ctrl+S. Then click on the {}
next to the Keyboard Shortcuts
tab to open up the keybindings.json
file.
After doing so, find some open space anywhere in the file, and type in the key bind below.
{
"key": "ctrl+k",
"command": "workbench.action.terminal.clear",
"when": "terminalFocus"
}
FOR VERSIONS UP TO
v1.32
SEE BELOW
This is for Visual Studio Code v1.18
up to v1.32
, I believe; I am on v1.29.1
. Since apparently there are a whole lot of assumptions about the default bindings, here is how you set up a binding, then use it. Keep in mind this binding will completely delete all of the history in your terminal too.
Open up the Keyboard Shortcuts
with Ctrl+K, Ctrl+S. Once you are in Keyboard Shortcuts
, click on keybindings.json
in the text that says ....open and edit keybindings.json
. Then on the RIGHT side, in the keybindings.json
, add this (make sure you put a comma before the first {
if there are one or more bindings already):
{
"key": "ctrl+k",
"command": "workbench.action.terminal.clear",
"when": "terminalFocus"
}
FOR ALL VERSIONS
Remember, the "key":
can be whatever binding you want. It doesn't HAVE to be Ctrl + K.
To use the keybinding, you must have focus in your terminal, and then do the binding.
To clear Terminal in VS Code simply press Ctrl + Shift + P
key together this will open a command palette and type command Terminal: Clear
. Also you will go to View in taskbar upper left corner of vs code and open Command pallete.
This will clear the terminal easily & work for any directory you have open in your terminal. This is for Windows, also try if it works for Mac.
This is command is work in all VS code versions include latest version 1.52.1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With