Skip to content
Tutorials Center
My learning

Topics

Lesson 25 of 40 ยท Tasks and Terminal

The Integrated Terminal

Use the VS Code integrated terminal well: open, split and rename terminals, run selections, send text, search output, and the shortcuts and settings that matter.

VS Code includes a full terminal inside the editor. It starts in your project folder, uses your normal shell and lives in the bottom panel, so you can run npm test or git status without switching windows. It is a real terminal, not a simulation: whatever your shell can do, it can do.

In this lesson you will learn how to open and manage terminals, the shortcuts that save time, and a few settings worth knowing. This site cannot run the editor, so the examples are described precisely, and the runnable code blocks are small stand-ins that show the ideas behind them.

Opening and managing terminals

  • Toggle the terminal panel: Ctrl+` (backtick).
  • New terminal: Ctrl+Shift+`. It opens in the workspace folder; in a multi-root workspace you choose which folder.
  • Split terminal: Ctrl+Shift+5, or the split icon in the toolbar. Two shells side by side share one tab.
  • Switch between terminals: use the list at the right of the panel, or Ctrl+PageUp and Ctrl+PageDown.
  • Rename or recolor a terminal: right-click its entry in the list. Names and icons make five terminals easy to tell apart.
  • Kill a terminal: the trash icon. Closing it stops its running process.
  • Maximize the panel: the arrow icon in the panel toolbar, or View: Toggle Maximized Panel.
  • Move to the editor area: Terminal: Move Terminal into Editor Area lets a terminal live in a regular tab, or in a separate window.

The panel can also hold the Problems, Output, Debug Console and Ports views; the terminal is simply one of the tabs.

Working directory and shell

A new terminal starts in the folder of the workspace. Set the shell with the profile dropdown (the arrow next to +). Profiles are covered in the next lesson, terminal profiles and shell integration.

You can ask VS Code to open a terminal at a specific folder: right-click a folder in the Explorer and choose Open in Integrated Terminal.

Sending code to the terminal

Several commands push text into the active terminal:

  • Terminal: Run Selected Text in Active Terminal runs the text you selected in the editor.
  • Terminal: Run Active File in Active Terminal runs the whole file path as a command.
  • Terminal: Send Sequence (used from key bindings) sends exact characters, such as \u0003 for Ctrl+C.

This is handy for shell scripts, SQL command-line clients and any snippet you want to try without copying and pasting.

  • Find in terminal: Ctrl+F when the terminal has focus. It searches the scroll-back.
  • Copy: Ctrl+C when text is selected, or Ctrl+Shift+C. Without a selection, Ctrl+C still sends an interrupt to the program.
  • Paste: Ctrl+V or Ctrl+Shift+V. On a multi-line paste, VS Code can warn you first; see terminal.integrated.enableMultiLinePasteWarning.
  • Clickable output: file paths such as src/app.js:12:5 open in the editor at that line with Ctrl+Click. URLs open in the browser. This is why error messages from tools are so easy to follow.
  • Command navigation: with shell integration, Ctrl+Up and Ctrl+Down jump between previous commands, and Run Recent Command (Ctrl+Alt+R) searches your history.

Settings worth knowing

JSON
{
  "terminal.integrated.fontSize": 14,
  "terminal.integrated.scrollback": 10000,
  "terminal.integrated.cursorStyle": "line",
  "terminal.integrated.defaultLocation": "view",
  "terminal.integrated.copyOnSelection": false,
  "terminal.integrated.persistentSessionReviveProcess": "onExit"
}

scrollback sets how many lines are kept. defaultLocation chooses between the panel ("view") and an editor tab ("editor"). Terminals can restore their content after a reload; the persistent-session settings control that.

You can also add environment variables for terminals launched by VS Code, per platform, with terminal.integrated.env.windows, .osx or .linux:

JSON
{
  "terminal.integrated.env.linux": { "APP_ENV": "development" }
}

Tabs for jobs

A common workflow keeps one terminal per long-running job: one for the dev server, one for tests in watch mode, one for ad-hoc Git commands. Rename them so you always know which is which. Stopping a job is Ctrl+C in its terminal; if the process refuses, kill the terminal.

flowchart LR
    A["Panel"] --> B["server (npm run dev)"]
    A --> C["tests (watch)"]
    A --> D["git / scratch"]

One terminal per job.

Runnable stand-ins

These stand-ins do not talk to a terminal. They model two ideas you meet there: how clickable file:line:column links are found in output, and how a command history can be searched.

JS Stand-in: find clickable file links in output

Press Run (or Ctrl + Enter) to see the console output here.

No output.

JS Stand-in: search command history

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which shortcut toggles the terminal panel?

    Ctrl+ (backtick) shows and hides the terminal panel. Ctrl+Shift+ creates a new one.
  2. 2. What does Ctrl+Click on src/app.js:12:5 in terminal output do?

    VS Code recognizes path:line:column and opens the editor at that position.
  3. 3. You want to run selected lines from a script in the terminal. Which command fits?

    Run Selected Text sends the selection to the active terminal.
  4. 4. What happens when you close a terminal tab that is running a dev server?

    Killing the terminal ends its shell and the processes attached to it.

Summary

  • Toggle the panel with Ctrl+` and create terminals with Ctrl+Shift+`.
  • Split, rename and color terminals so each job is easy to find.
  • Send selections or files to the terminal with the run commands.
  • Use Ctrl+Click on path:line:column output to jump to code.
  • Tune font, scrollback and location with terminal.integrated.* settings.

Next: Terminal Profiles and Shell Integration