# How to Open a Terminal in VS Code: Complete Guide to vscode open terminal

> Easily open a new terminal in VS Code. Learn the keyboard shortcut Ctrl+Shift+` or Cmd+Shift+` to access the integrated shell and streamline your workflow.

- Repository: [Microsoft/vscode](https://github.com/microsoft/vscode)
- Tags: how-to-guide
- Published: 2026-02-16

---

**Press Ctrl+Shift+` (Windows/Linux) or Cmd+Shift+` (macOS) to instantly open a new integrated terminal, or invoke the `workbench.action.terminal.new` command ID programmatically.**

The vscode open terminal functionality provides a built-in shell environment directly within the editor, eliminating the need to switch between applications. This guide examines the correct implementation methods based on the actual source code in the microsoft/vscode repository, covering both user interface shortcuts and extension API patterns.

## Understanding the vscode open terminal Architecture

The integrated terminal system centers on the command ID **`workbench.action.terminal.new`**, registered in [`src/vs/workbench/contrib/terminal/browser/terminalActions.ts`](https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/terminal/browser/terminalActions.ts) (lines 1214-1224). When triggered, this command invokes the `ITerminalService.createTerminal` method defined in [`src/vs/workbench/contrib/terminal/common/terminal.ts`](https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/terminal/common/terminal.ts), which handles the actual shell process spawning based on your default terminal profile.

## User Interface Methods for vscode open terminal

### Keyboard Shortcuts

The fastest way to perform a vscode open terminal action uses the default key binding:

- **Windows/Linux:** Press **Ctrl+Shift+`**
- **macOS:** Press **Cmd+Shift+`**

This shortcut directly dispatches the `workbench.action.terminal.new` command registered in [`terminalActions.ts`](https://github.com/microsoft/vscode/blob/main/terminalActions.ts).

### Command Palette

Open the Command Palette with **Ctrl+Shift+P** (Windows/Linux) or **Cmd+Shift+P** (macOS), then type "Terminal: New Terminal". Selecting this entry executes the same `workbench.action.terminal.new` command ID, creating a terminal instance using your default profile.

### Menu and UI Buttons

Navigate to **Terminal → New Terminal** in the application menu, or click the **+** icon in the Terminal panel. These UI elements are wired through [`src/vs/workbench/contrib/terminal/browser/terminalMenus.ts`](https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/terminal/browser/terminalMenus.ts), which binds the menu items to the `workbench.action.terminal.new` command.

## Programmatic vscode open terminal for Extensions

### Using the Extension API

Extensions can create terminals using the `vscode.window.createTerminal()` method, exposed through [`src/vs/workbench/api/common/extHostExtensionApi.ts`](https://github.com/microsoft/vscode/blob/main/src/vs/workbench/api/common/extHostExtensionApi.ts). This returns a `Terminal` object that you can control programmatically.

```typescript
import * as vscode from 'vscode';

function openTerminal() {
    // Create terminal with default profile
    const terminal = vscode.window.createTerminal({
        name: 'Custom Terminal',
        cwd: vscode.workspace.workspaceFolders?.[0].uri.fsPath
    });
    
    // Show the terminal panel
    terminal.show();
}

```

### Executing the Built-in Command

For simple terminal creation without needing a handle to the object, execute the internal command directly:

```typescript
await vscode.commands.executeCommand('workbench.action.terminal.new');

```

This bypasses the extension API wrapper and triggers the registration in [`terminalActions.ts`](https://github.com/microsoft/vscode/blob/main/terminalActions.ts) directly.

### Opening in the Editor Area

To open a terminal as a tab in the editor area rather than the bottom panel, specify the location:

```typescript
const terminal = vscode.window.createTerminal({
    name: 'Editor Terminal',
    location: { viewColumn: vscode.ViewColumn.Beside }
});
terminal.show();

```

This corresponds to the `TerminalLocation.Editor` handling in the internal terminal service.

### Sending Commands to the Terminal

Once opened, you can programmatically send shell commands:

```typescript
const terminal = vscode.window.createTerminal();
terminal.show();
terminal.sendText('npm install', true);

```

The `sendText` method forwards input to the underlying PTY, matching the behavior of the **Run Selected Text** action.

## Key Implementation Files

The vscode open terminal functionality is distributed across these critical source files in the microsoft/vscode repository:

- **[`src/vs/workbench/contrib/terminal/browser/terminalActions.ts`](https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/terminal/browser/terminalActions.ts)** – Registers the `workbench.action.terminal.new` command and handles UI action bindings.
- **[`src/vs/workbench/contrib/terminal/common/terminal.ts`](https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/terminal/common/terminal.ts)** – Defines the `ITerminalService` interface and `TerminalCommandId` enum.
- **[`src/vs/workbench/contrib/terminal/browser/terminalMenus.ts`](https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/terminal/browser/terminalMenus.ts)** – Wires terminal commands to menu items and context menus.
- **[`src/vs/platform/terminal/common/terminalService.ts`](https://github.com/microsoft/vscode/blob/main/src/vs/platform/terminal/common/terminalService.ts)** – Low-level service that spawns shell processes based on selected profiles.
- **[`src/vs/workbench/api/common/extHostExtensionApi.ts`](https://github.com/microsoft/vscode/blob/main/src/vs/workbench/api/common/extHostExtensionApi.ts)** – Exposes `vscode.window.createTerminal` to extensions.

## Summary

- The primary command ID for opening a terminal is **`workbench.action.terminal.new`**, registered in [`terminalActions.ts`](https://github.com/microsoft/vscode/blob/main/terminalActions.ts).
- **Keyboard shortcuts** (Ctrl+Shift+` / Cmd+Shift+`) provide the fastest UI access to the integrated terminal.
- Extensions should use **`vscode.window.createTerminal()`** to obtain a terminal handle for programmatic control, or **`vscode.commands.executeCommand('workbench.action.terminal.new')`** for simple triggering.
- The **location** parameter allows opening terminals in the editor area instead of the bottom panel.
- All pathways ultimately invoke `ITerminalService.createTerminal` to spawn the shell process using the default profile.

## Frequently Asked Questions

### What is the keyboard shortcut to open a terminal in VS Code?

Press **Ctrl+Shift+`** (backtick) on Windows and Linux, or **Cmd+Shift+`** on macOS. This shortcut dispatches the `workbench.action.terminal.new` command immediately, creating a new terminal instance with your default shell profile.

### How do I open a terminal programmatically in a VS Code extension?

Use the `vscode.window.createTerminal()` method to create a terminal object, then call `terminal.show()` to reveal it. Alternatively, execute the built-in command with `await vscode.commands.executeCommand('workbench.action.terminal.new')` if you do not need to interact with the terminal instance afterward.

### Can I open a terminal in the editor area instead of the bottom panel?

Yes. When calling `vscode.window.createTerminal()`, pass the `location` option with `{ viewColumn: vscode.ViewColumn.Beside }` or another view column value. This opens the terminal as a tab in the editor area rather than in the integrated terminal panel.

### Where is the vscode open terminal command defined in the source code?

The command is registered in [`src/vs/workbench/contrib/terminal/browser/terminalActions.ts`](https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/terminal/browser/terminalActions.ts) under the ID `workbench.action.terminal.new` (lines 1214-1224). The underlying service interface is defined in [`src/vs/workbench/contrib/terminal/common/terminal.ts`](https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/terminal/common/terminal.ts), while the extension API exposure lives in [`src/vs/workbench/api/common/extHostExtensionApi.ts`](https://github.com/microsoft/vscode/blob/main/src/vs/workbench/api/common/extHostExtensionApi.ts).