How to Use VS Code Terminal Shell Integration and Command Decorations

Enable VS Code shell integration to get command decorations, run recent commands, navigate between commands, and use sticky scroll in the integrated terminal.

5 min read

Shell integration connects VS Code to your terminal shell so it can track commands, exit codes, and the working directory automatically. It is enabled by default for supported shells and requires no setup in most cases. This is what powers command decorations, sticky scroll, and quick fixes in the integrated terminal.

Start with how to open and use the integrated terminal if you are new to the integrated terminal. If you want to customize how the terminal looks while shell integration runs, see how to customize the terminal font, colors, and cursor.

Check if shell integration is active

Shell integration is enabled by default for all supported shells. To confirm it is working:

Open the integrated terminal

Press Ctrl+` (Windows/Linux) or Cmd+` (macOS).

Hover over the terminal tab

The tab sits on the right side of the terminal panel.

Read the tooltip

It shows one of three quality levels.

QualityWhat it means
RichFull shell integration is active. Command detection, decorations, and navigation all work.
BasicPartial detection. Commands are tracked but exit codes may be missing.
NoneShell integration is not active. Decoration and navigation features are unavailable.

If you see None, shell integration may be disabled. Open Settings and search for terminal.integrated.shellIntegration.enabled. Make sure it is not set to false.

Supported shells

Shell integration works automatically on these shells:

PlatformSupported shells
Windowspwsh (PowerShell 7+), Git Bash
macOSbash, fish, pwsh, zsh
Linuxbash, fish, pwsh, zsh

Automatic injection works by passing arguments and environment variables when the shell launches. If your shell setup is complex or you are connecting over a regular SSH session (without the Remote - SSH extension), you may need to install shell integration manually.

Understand command decorations

When shell integration is active, VS Code adds visual markers next to each command you run in the terminal.

A blue circle appears next to successful commands. A red circle with an X appears next to failed commands. The same colors appear in the scroll bar overview ruler, so you can see at a glance where errors happened in long output.

Click any decoration to open a context menu with actions including:

  • Copy Output: Copy the command and its output.
  • Copy Output as HTML: Copy with formatting preserved.
  • Rerun Command: Run the same command again.

The terminal.integrated.shellIntegration.decorationsEnabled setting controls where decorations appear. Valid values are both, gutter, overviewRuler, never, with both as the default. Set it to never to hide decorations entirely.

Use keyboard shortcuts to jump between commands instead of scrolling manually.

ActionWindows/LinuxmacOS
Scroll to previous commandCtrl+UpCmd+Up
Scroll to next commandCtrl+DownCmd+Down
Select to previous commandCtrl+Shift+UpCmd+Shift+Up
Select to next commandCtrl+Shift+DownCmd+Shift+Down

The terminal scrolls instantly to the command and highlights it. This is much faster than searching through output by hand.

Use the command guide

Hover over any command in the terminal to see a vertical bar appear next to it. This is the command guide. It visually groups a command with its output, making long terminal sessions easier to read.

You can toggle the command guide with the terminal.integrated.shellIntegration.showCommandGuide setting. The color of the guide bar follows your active color theme.

Enable sticky scroll

Sticky scroll keeps the current command visible at the top of the terminal viewport as you scroll through its output. This way you never lose track of which command produced the output you are reading.

Enable it in Settings by searching for terminal.integrated.stickyScroll.enabled and checking the box. Click the sticky command at the top to jump back to its position in the terminal.

Run a recent command

Instead of retyping or using the shell's reverse search, use VS Code's built-in command history.

Press Ctrl+Alt+R (Windows/Linux) or run Terminal: Run Recent Command from the Command Palette. A Quick Pick menu appears with your command history organized into sections:

  • Current session: Commands you have run in this terminal session.
  • Previous session: Commands from past VS Code sessions for the same shell type.
  • Shell history file: Commands from your shell's own history file.

Type to filter the list. Press Enter to run the selected command, or hold Alt to paste it into the terminal without running it. The clipboard icon on the right opens the command's full output in an editor.

The amount of history stored is controlled by the terminal.integrated.shellIntegration.history setting.

Go to a recent directory

Similar to Run Recent Command, the Terminal: Go to Recent Directory command tracks directories you have visited and lets you quickly cd back to any of them. The default shortcut is Ctrl+G on Windows and Linux, or Cmd+G on macOS. Hold Alt to write the path without running it.

Use terminal IntelliSense

When shell integration is active, the terminal suggests completions for commands, arguments, file paths, and folders as you type. This is controlled by the terminal.integrated.suggest.enabled setting, which is on by default.

Press Ctrl+Space to trigger suggestions manually. By default, Tab inserts the selected suggestion. You can configure this behavior with the terminal.integrated.suggest.selectionMode setting.

Quick fixes for common errors

VS Code scans terminal output and offers Quick Fixes when it detects a common problem. For example:

  • A port is already in use: VS Code suggests killing the process and rerunning the command.
  • A git push fails because no upstream is set: VS Code suggests pushing with the upstream flag.
  • A git subcommand is misspelled: VS Code suggests the closest matching command.
  • A git push succeeds and could open a pull request: VS Code offers to open the link.

When a Quick Fix is available, a lightbulb icon appears in the terminal. Click it or press Ctrl+. (Cmd+. on macOS) to see the suggested actions.

Manual installation for complex setups

If automatic injection does not work for your shell, you can add the shell integration script directly to your shell's rc file. Run this command in VS Code's terminal to get the path:

bashbash
code --locate-shell-integration-path bash

Then add the result to your shell's startup file. For example, in zsh you would add this line to ~/.zshrc so the integration script loads every time a terminal opens:

bashbash
[[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --locate-shell-integration-path zsh)"

Replace zsh, bash, fish, or pwsh with the name of your shell. When using manual installation, it is recommended (though not required) to set terminal.integrated.shellIntegration.enabled to false to avoid double injection.

What to do if decorations are missing or wrong

If command decorations appear in the wrong position or jump around, especially on Windows, this is a known issue with the ConPTY backend. VS Code uses heuristics to improve placement after a command runs. The decorations should settle into the correct position automatically.

If decorations do not appear at all despite shell integration being enabled, check the decorationsEnabled setting described above. Some third-party shell plugins disable shell integration by unsetting the VSCODE_SHELL_INTEGRATION environment variable.

Rune AI

Rune AI

Key Insights

  • Shell integration is on by default for bash, fish, pwsh, zsh, and Git Bash.
  • Blue circles mark successful commands; red circles with an X mark failed ones.
  • Navigate between commands with Ctrl+Up and Ctrl+Down (Cmd on macOS).
  • Run recent commands with Terminal: Run Recent Command (Ctrl+Alt+R).
  • Enable sticky scroll with terminal.integrated.stickyScroll.enabled.
  • Hover a terminal tab to check shell integration quality.
RunePowered by Rune AI

Frequently Asked Questions

Why are command decorations not showing in my terminal?

Shell integration may be disabled. Check that terminal.integrated.shellIntegration.enabled is not set to false. Also check terminal.integrated.shellIntegration.decorationsEnabled is not set to never. Some shell plugins disable shell integration by unsetting VSCODE_SHELL_INTEGRATION.

How do I know if shell integration is working?

Hover over a terminal tab. The tooltip shows the shell integration quality: Rich, Basic, or None. Rich means full command detection is working. Basic means partial detection. None means shell integration is not active.

Can I use shell integration over a regular SSH connection without the Remote - SSH extension?

Automatic injection does not work over regular SSH sessions. You can install shell integration manually by adding the integration script to your shell's rc file on the remote machine. See the manual installation instructions for your shell.

Conclusion

Shell integration makes the terminal smarter. It shows which commands succeeded or failed with visual decorations, lets you navigate between commands with keyboard shortcuts, suggests quick fixes for common errors, and remembers your command history across sessions. It works automatically on supported shells and you can verify it is active by hovering any terminal tab.