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
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 terminalSet 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 testYou 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