Script Valley
Developer Environment Setup (WSL, Terminal, VS Code)
VS Code Setup and WSL2 IntegrationLesson 5.4

How to use the VS Code integrated terminal with WSL2

opening terminal in VS Code, setting default shell to zsh, multiple terminal instances, terminal split, terminal profile configuration, running npm scripts from terminal

VS Code Integrated Terminal

VS Code integrated terminal diagram

When VS Code is connected to WSL2, its integrated terminal opens a shell directly inside Linux. This is the terminal you should use for all development commands โ€” no switching between windows.

Open and manage terminals

Ctrl+backtick           # toggle terminal panel
Ctrl+Shift+backtick     # new terminal instance
Ctrl+Shift+5            # split terminal

Set the default shell to Zsh

{
  "terminal.integrated.defaultProfile.linux": "zsh",
  "terminal.integrated.profiles.linux": {
    "zsh": { "path": "/usr/bin/zsh" }
  }
}

Running npm scripts

npm install
npm run dev
npm test

You can run multiple terminals simultaneously โ€” one for the dev server, one for tests, one for git commands. Use the terminal dropdown to switch between them, or click the split icon to view two side by side.

Clearing and restarting

Ctrl+L    # clear terminal screen
exit      # close the terminal session

Up next

How to debug Node.js applications in VS Code with WSL2

Sign in to track progress

How to use the VS Code integrated terminal with WSL2 โ€” VS Code Setup and WSL2 Integration โ€” Developer Environment Setup (WSL, Terminal, VS Code) โ€” Script Valley โ€” Script Valley