Text of code.visualstudio.com › docs › terminal › advanced as Styx crawled it on Nov 18, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

Terminal Advanced

AI agents: See llms.txt for documentation discovery and navigation. Documentation articles are also available as Markdown by appending .md to the article URL. Join VS Code at Microsoft Ignite or catch the sessions online. A year of VS Code, wrapped. Explore the highlights. Terminal Advanced View as Markdown Ask in VS Code Ask in VS Code Insiders Visual Studio Code's integrated terminal has many advanced features and settings, such as Unicode and emoji support, custom keyboard shortcuts, and automatic replies.

This topic explains these advanced features in detail. If you are new to VS Code or the integrated terminal, you may want to review the Terminal Basics topic first. Persistent sessions The terminal supports two different types of persistent sessions: Process reconnection: When reloading a window (for example, after installing an extension), reconnect to the previous process and restore its content. Process revive: When restarting VS Code, a terminal's content is restored and the process is relaunched using its original environment.

Both of these persistent sessions can be disabled by setting terminal.integrated.enablePersistentSessions Open in VS Code Open in VS Code Insiders to false , and the amount of scrollback restored is controlled by the terminal.integrated.persistentSessionScrollback Open in VS Code Open in VS Code Insiders setting. Process revive can be configured independently with terminal.integrated.persistentSessionReviveProcess Open in VS Code Open in VS Code Insiders .

Moving terminals between windows Terminal tabs can be dragged and dropped between VS Code windows. This can also be done manually through the Command Palette and the Terminal: Detach Session and Terminal: Attach to Session commands. Configure terminal visibility When opening a window, if the terminal view is visible it will either reconnect to the terminal using persistent sessions, or create a new shell. This behavior can be fine tuned with the terminal.integrated.hideOnStartup Open in VS Code Open in VS Code Insiders setting. never (default): Never hide the terminal view on startup. whenEmpty : Only hide the terminal when there are no persistent sessions restored. always : Always hide the terminal, even when there are persistent sessions restored.

The terminal.integrated.hideOnLastClosed Open in VS Code Open in VS Code Insiders setting is also available to override the default behavior of closing the terminal view when the last terminal is closed. Keyboard shortcuts and the shell As an embedded application, the integrated terminal should intercept some, but not all, keyboard shortcuts dispatched within VS Code. The configurable terminal.integrated.commandsToSkipShell Open in VS Code Open in VS Code Insiders setting determines which command's keyboard shortcuts should always "skip the shell" and instead be handled by VS Code's keyboard shortcut system.

By default, it contains a hard-coded list of commands that are integral to the VS Code experience but you can add or remove specific commands: { "terminal.integrated.commandsToSkipShell" : [ // Ensure the toggle sidebar visibility keyboard shortcut skips the shell "workbench.action.toggleSidebarVisibility" , // Send quick open's keyboard shortcut to the shell "-workbench.action.quickOpen" , ] } Look at the terminal.integrated.commandsToSkipShell Open in VS Code Open in VS Code Insiders setting details to see the complete list of default commands.

Tip: terminal.integrated.sendKeybindingsToShell Open in VS Code Open in VS Code Insiders can be configured to override terminal.integrated.commandsToSkipShell Open in VS Code Open in VS Code Insiders and dispatch most keyboard shortcuts to the shell. Note that this will disable keyboard shortcuts like Ctrl+F to open find though. Chords Chord keyboard shortcuts are made up of two keyboard shortcuts, for example Ctrl+K followed by Ctrl+C to change the line to a comment.

Chords always skip the shell by default but can be disabled with terminal.integrated.allowChords Open in VS Code Open in VS Code Insiders . macOS clear screen On macOS, Cmd+K is a common keyboard shortcuts in terminals to clear the screen so VS Code also respects that, which means Cmd+K chords will not work. Cmd+K chords can be enabled by removing the clear keyboard shortcut : { "key" : "cmd+k" , "command" : "-workbench.action.terminal.clear" } Additionally, this keyboard shortcut will be overridden automatically if any extensions contribute Cmd+K keyboard shortcuts due to how keyboard shortcut priority works.

To re-enable the Cmd+K clear keyboard shortcut in this case, you can redefine it in user keyboard shortcuts, which have a higher priority than extension keyboard shortcuts: { "key" : "cmd+k" , "command" : "workbench.action.terminal.clear" , "when" : "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" } Mnemonics Using mnemonics to access VS Code's menu (for example, Alt+F for File menu) is disabled by default in the terminal as these key events are often important hotkeys in shells.

Set terminal.integrated.allowMnemonics Open in VS Code Open in VS Code Insiders to enable mnemonics, but note that this will disallow any Alt key events to go to the shell. This setting does nothing on macOS. Custom sequence keyboard shortcuts The workbench.action.terminal.sendSequence command can be used to send a specific sequence of text to the terminal, including escape sequences that are interpreted specially by the shell.

The command enables you to send Arrow keys, Enter , cursor moves, and more. Run this command via the Command Palette, which allows for manual input, but it's most useful when you assign a custom keyboard shortcut with arguments. For example, the sequence below jumps over the word to the left of the cursor ( Ctrl+Left ) and then presses Backspace : { "key" : "ctrl+u" , "command" : "workbench.action.terminal.sendSequence" , "args" : { "text" : " \u001b [1;5D \u007f " } } This feature supports variable substitution .

The sendSequence command only works with the \u0000 format for using characters via their character code (not \x00 ). Read more about these hex codes and terminal sequences in the following resources: XTerm Control Sequences List of C0 and C1 control codes Send a custom signal The workbench.action.terminal.sendSignal command can be used to send an arbitrary signal to the foreground process in the active terminal. For example, the below keybinding will send SIGTERM , causing it to terminate gracefully. { "key" : "ctrl+shift+/" , "command" : "workbench.action.terminal.sendSignal" , "args" : { "signal" : "SIGTERM" } } Confirmation dialogs In order to avoid unnecessary output and user prompts, the terminal does not show warning dialogs when processes exit.

If warnings are desirable, they can be configured with the following settings: terminal.integrated.confirmOnExit Open in VS Code Open in VS Code Insiders - Controls whether to confirm when the window closes if there are active terminal sessions. terminal.integrated.confirmOnKill Open in VS Code Open in VS Code Insiders - Controls whether to confirm killing terminals when they have child processes. terminal.integrated.showExitAlert Open in VS Code Open in VS Code Insiders - Controls whether to show the alert "The terminal process terminated with exit code" when exit code is non-zero.

Auto replies The terminal can automatically provide a configurable input response to the shell if an exact sequence of output is received. The most common use case is to automatically reply to a prompt when hitting Ctrl+C in batch scripts that ask whether the user wants to terminate the batch job. To automatically dismiss this message, add this setting: { "terminal.integrated.autoReplies" : { "Terminate batch job (Y/N)" : "Y \r " } } Notice that the \r character used here means Enter , and much like custom sequence keyboard shortcuts , this feature supports sending escape sequences to the shell.

No auto replies are configured by d

The rest of this page is on the live site.