To open the terminal in VS Code, press Ctrl+` (backtick) on Windows and Linux or Control+` on macOS, or choose Terminal > New Terminal from the menu. It opens at the folder you have open in the Explorer, using your default shell.
Everything below comes from the official VS Code documentation. Shortcuts are the defaults; if you changed your keybindings, yours may differ.
How to open the VS Code terminal
There are four ways to get a terminal:
- Menu: Terminal > New Terminal, or View > Terminal.
- Command Palette: run
View: Toggle Terminal. - Explorer: right-click a folder and choose
Open in Integrated Terminal. The terminal starts in that folder. - Keyboard: the shortcuts in the table below.
| Action | Windows / Linux | macOS |
|---|---|---|
| Show or hide the terminal panel | Ctrl+` | Control+` |
| Create a new terminal | Ctrl+Shift+` | Control+Shift+` |
| New terminal in a new window | Ctrl+Shift+Alt+` | Control+Shift+Option+` |
| Split the terminal | Ctrl+Shift+5 | Cmd+\ |
| Next terminal group | Ctrl+PageDown | Shift+Cmd+] |
| Previous terminal group | Ctrl+PageUp | Shift+Cmd+[ |
| Find in the terminal | Ctrl+F | Cmd+F |
The toggle shortcut hides the panel but does not stop anything running in it. The shell keeps running until you kill the terminal (see below).
How to use multiple terminals
Terminal tabs appear on the right side of the TERMINAL view. Add one with the + icon, the profile dropdown beside it, or Ctrl+Shift+`. Typical use is one tab for a dev server and another for git commands.
To kill a terminal, use any of these:
- click the trash can on its tab
- select the tab and press
Delete - right-click the tab and use the menu
- run
Terminal: Kill the Active Terminal Instancefrom the Command Palette
If a dev server is still holding a port after you closed the window, see how to fix "port already in use".
How to split the terminal
Splitting puts two terminals side by side in one group. Use the split button on the terminal, right-click and choose Split, hold Alt while clicking a tab or the + button, or press Ctrl+Shift+5 (Cmd+\ on macOS).
Move focus between panes with Alt+Left and Alt+Right (Option+Cmd+Left and Option+Cmd+Right on macOS). To turn a pane back into its own group, run Terminal: Unsplit Terminal.
Split terminals start in the directory set by terminal.integrated.splitCwd.
How to put the terminal in the editor area
You can treat a terminal like an editor tab. Run Terminal: Create New Terminal in Editor Area (or ... in Editor Area to the Side) from the Command Palette, or drag a terminal from the panel into the editor area. To make this the default for new terminals, change the terminal.integrated.defaultLocation setting. Right-clicking a tab and choosing Move Terminal to New Window detaches it into its own window.
How to change the shell (terminal profile)
VS Code detects the shells installed on your machine and lists them in the dropdown next to the + button. On Windows the default is PowerShell; on Linux and macOS it is your $SHELL.
To change the default:
- Open the Command Palette (
Ctrl+Shift+P). - Run
Terminal: Select Default Profile. The same option is in the new-terminal dropdown. - Pick the shell, for example PowerShell, Command Prompt, Git Bash or a WSL distribution.
Behind the scenes this writes the profile name to a setting. You can set it yourself in settings.json:
{
"terminal.integrated.defaultProfile.windows": "Git Bash"
}
The Linux and macOS versions are terminal.integrated.defaultProfile.linux and terminal.integrated.defaultProfile.osx. The value must be the name of an existing profile.
Two details from the docs: Windows PowerShell is not listed when PowerShell 6 or later is installed, so choose it under Select Default Profile if you want it. WSL shells are detected automatically on a local machine, and terminal.integrated.useWslProfiles turns that off.
How to define your own profile
Profiles live under terminal.integrated.profiles.windows (or .linux, .osx). Each one uses either path or source. The source key is Windows-only and accepts PowerShell or Git Bash. Optional keys are args, env, overrideName, icon and color. This example, taken from the VS Code docs, adds a PowerShell profile that skips your profile script:
{
"terminal.integrated.profiles.windows": {
"PowerShell -NoProfile": {
"source": "PowerShell",
"args": ["-NoProfile"]
}
}
}
To remove a built-in profile from the dropdown, set its name to null, for example "Git Bash": null. To bind a keyboard shortcut to a profile, use the workbench.action.terminal.newWithProfile command with a profileName argument in keybindings.json.
If you use Git Bash, the docs note that command history is not kept across sessions by default. Adding export PROMPT_COMMAND='history -a' to ~/.bashrc or ~/.bash_profile fixes it.
Copy, paste, scroll and search
| Action | Windows | Linux | macOS |
|---|---|---|---|
| Copy / paste | Ctrl+C / Ctrl+V | Ctrl+Shift+C / Ctrl+Shift+V | Cmd+C / Cmd+V |
| Scroll one page | PageUp / PageDown | Shift+PageUp / Shift+PageDown | PageUp / PageDown |
| Scroll to top / bottom | Ctrl+Home / Ctrl+End | Shift+Home / Shift+End | Cmd+Home / Cmd+End |
| Previous / next command | Ctrl+Up / Ctrl+Down | Ctrl+Up / Ctrl+Down | Cmd+Up / Cmd+Down |
Jumping to the previous or next command needs shell integration. On Windows, right-click copies the selection, or pastes if nothing is selected. To copy text as soon as you select it, turn on terminal.integrated.copyOnSelection. Linux also supports Shift+Insert for pasting the selection.
Run code from the editor in the terminal
Select some text in an editor and run Terminal: Run Selected Text in Active Terminal from the Command Palette. With nothing selected, it runs the current line. To run the whole active file, use the command workbench.action.terminal.runActiveFile.
Set the starting folder
By default the terminal opens in the folder open in the Explorer. Set terminal.integrated.cwd to start somewhere else, and terminal.integrated.splitCwd to control where split terminals begin. If the terminal opens in the wrong place, check these two settings first.
Change the font and cursor
Three settings control the look of the terminal text. The docs describe them but do not state defaults here, so check the Settings UI (Ctrl+,, then search "terminal.integrated") for the current values.
terminal.integrated.fontFamilytakes a CSS-style font-family list, for example"'Fira Code', monospace". The later entries are fallbacks for glyphs the first font lacks.terminal.integrated.fontSizesets the size of the text.terminal.integrated.cursorStylecan be block, line or underline.
If something does not work
- The shortcut does nothing. Another program or a keyboard layout may use the backtick key differently. Open the terminal from Terminal > New Terminal, and rebind
View: Toggle Terminalin Keyboard Shortcuts if needed. - The shell you want is missing from the dropdown. Define it under
terminal.integrated.profiles.windows(or the Linux or macOS equivalent) with apath. - The terminal is hidden but a process is still running. Toggling the panel does not kill the shell. Kill the terminal from its tab.
- Select All has no shortcut.
Terminal: Select Allis bound only on macOS (Cmd+A). On Windows and Linux, run it from the Command Palette or bind your own key.
Frequently asked questions
- What is the shortcut to open the terminal in VS Code?
- Press Ctrl+` (backtick) on Windows and Linux, or Control+` on macOS, to show or hide the terminal panel. Ctrl+Shift+` (Control+Shift+` on macOS) creates a new terminal instead of toggling the panel.
- How do I change the default shell in the VS Code terminal?
- Run Terminal: Select Default Profile from the Command Palette, or choose it from the dropdown next to the + button, then pick a shell. You can also set terminal.integrated.defaultProfile.windows (or .linux, .osx) in settings.json to the name of an existing profile.
- How do I close a terminal in VS Code?
- Click the trash can icon on the terminal's tab, select the tab and press Delete, or run Terminal: Kill the Active Terminal Instance from the Command Palette. Hiding the panel with Ctrl+` does not stop the running shell.
- Why does my VS Code terminal open in the wrong folder?
- By default the terminal starts in the folder opened in the Explorer. If it starts somewhere else, check whether terminal.integrated.cwd is set in your settings. Split terminals use terminal.integrated.splitCwd for their starting directory.