VS Code Terminal and CLI/Run selected text in active terminal

Send selected code to the terminal.

Section: Integrated Terminal

Run selected text in active terminal

text
text
Command Palette: Terminal: Run Selected Text in Active Terminal

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Integrated Terminal
Create new terminal
Open another terminal session.
OpenIn sheettextsame section
Split terminal
Create side-by-side terminal panes.
OpenIn sheettextsame section
Rename terminal
Give a terminal tab a meaningful name.
OpenIn sheettextsame section
Wait until editor closes
Useful from Git commit editors and automation scripts.
OpenIn sheetbash1 tag match
Show VS Code CLI help
Display usage and options.
Install an extension from the CLI
Add an extension by identifier.