The integrated terminal

VS Code · Practical · 8 min

Keeping the terminal next to your code avoids window switching and lets VS Code link errors back to files.

` Ctrl+ ` toggles the **integrated terminal** in the panel; it starts in the workspace folder with your default shell. Ctrl+Shift+ `` opens another one.

  • Several terminals appear as tabs on the right of the panel; you can split one (Ctrl+Shift+5) to see two side by side, and rename or colour them.
  • The dropdown next to + chooses a profile: bash, zsh, PowerShell, Git Bash, a WSL distro... Set the default with the terminal.integrated.defaultProfile.<os> setting.
  • Terminals can be dragged into the editor area or moved to a separate window.

Shell integration (on by default for bash, zsh, fish and PowerShell) lets VS Code understand commands: decorations mark each command as succeeded or failed, Ctrl+Up/Down jumps between commands, and the "Run Recent Command" picker (Ctrl+Alt+R) searches history across sessions.

Links: file paths with line numbers in output (src/app.ts:42:7) and URLs are clickable with Ctrl+Click, which is how test failures take you straight to the line.

To send code to a terminal, select it and run "Terminal: Run Selected Text In Active Terminal". Language extensions often add their own, such as running the current Python file. Note that the integrated terminal inherits the environment from VS Code itself; if you change PATH in your profile, restart VS Code, not just the terminal.

Example

# Ctrl+`             toggle terminal panel
# Ctrl+Shift+`       new terminal
# Ctrl+Shift+5       split terminal
# Ctrl+Up / Ctrl+Down   jump between previous commands (shell integration)
# Ctrl+Alt+R         run recent command
# Ctrl+Click         open file:line or URL from the output
// settings.json
{
  "terminal.integrated.defaultProfile.linux": "zsh",
  "terminal.integrated.scrollback": 10000
}

Remember

  • Ctrl+` toggles; terminals can be split, named and moved
  • Profiles choose the shell; set a default per OS
  • Shell integration adds command navigation and clickable paths

Watch out for

  • Updating PATH in your shell profile and expecting the existing VS Code window to see it; restart VS Code.

Check yourself

  1. Clicking `src/app.ts:42:7` in terminal output with Ctrl does what?

Sign in to answer, see the explanations, and get this lesson back as a quick review later.

Official docs: code.visualstudio.com/docs/terminal/basics