How to Install VS Code on Ubuntu

Tech reviewed: Deepak Prasad
Install VS Code on Ubuntu banner with Visual Studio Code editor interface and Ubuntu orange accent

Visual Studio Code (VS Code) is Microsoft’s cross-platform code editor for Ubuntu—syntax highlighting, Git integration, debugging, and extensions from the Visual Studio Marketplace. It is not the same product as full Visual Studio IDE on Windows, and it is not shipped in the default Ubuntu archive under the name you expect.

This guide covers how to install VS Code on Ubuntu and download VS Code for Ubuntu through every supported path: the official packages.microsoft.com APT repository, a direct .deb, Snap, and VS Code Insiders. I ran the repository installs on Ubuntu 25.04 and ended with stable 1.126.0 (code) and Insiders 1.127.0 (code-insiders) from the same Microsoft repo.

Tested on: Ubuntu 25.04 (Plucky Puffin); kernel 6.14.0-37-generic.

NOTE
Ubuntu’s default apt search does not list Microsoft’s code package—you add Microsoft’s repository or use Snap. The must-have Ubuntu apps roundup notes that VS Code falls in that vendor/Snap bucket on current releases.

Quick command summary

Task Command
Add Microsoft APT repo See Step 1 below
Install stable VS Code sudo apt install -y code
Install VS Code Insiders sudo apt install -y code-insiders
Check stable version python3 -c "import json; print(json.load(open('/usr/share/code/resources/app/package.json'))['version'])"
Check Insiders version code-insiders --version
Download latest .deb wget -O code.deb https://update.code.visualstudio.com/latest/linux-deb-x64/stable
Non-interactive .deb + repo echo "code code/add-microsoft-repo boolean true" | sudo debconf-set-selections then sudo apt install -y ./code.deb
Install via Snap (stable) sudo snap install code --classic
Install via Snap (Insiders) sudo snap install code-insiders --classic
Open current folder code .
Remove APT stable sudo apt purge -y code

Prerequisites

  • Ubuntu 22.04 LTS, 24.04 LTS, or newer (25.04 tested here). Microsoft publishes amd64, arm64, and armhf builds in the same repo.
  • sudo and HTTPS access to packages.microsoft.com and code.visualstudio.com.
  • A desktop session (or X11/Wayland forwarding) if you want the graphical editor on the same machine. Pure SSH servers can still install the package for the code CLI and Remote SSH workflows from another computer.
  • About 195 MB download per package and ~870 MB installed under /usr/share/code (similar size for Insiders).
  • Optional: Git and Node via nvm for typical web development stacks after the editor is installed.

Stable vs Insiders

VS Code (stable) VS Code Insiders
APT package code code-insiders
CLI code code-insiders
Release cadence Monthly stable + weekly patches Daily insider builds
Config directory ~/.config/Code ~/.config/Code - Insiders
Best for Production laptops, teaching labs Preview features, extension authors

You can install both from apt—they use different binaries and desktop entries (code.desktop and code-insiders.desktop).


Step 1: Add the official Microsoft APT repository

Microsoft documents a deb822 source file (not the older one-line deb format):

bash
sudo apt-get install -y wget gpg
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft.gpg
sudo tee /etc/apt/sources.list.d/vscode.sources > /dev/null <<'EOF'
Types: deb
URIs: https://packages.microsoft.com/repos/code
Suites: stable
Components: main
Architectures: amd64,arm64,armhf
Signed-By: /usr/share/keyrings/microsoft.gpg
EOF
sudo apt update

On Ubuntu 25.04 the Microsoft repo indexed cleanly:

text
Get:7 https://packages.microsoft.com/repos/code stable InRelease [3,590 B]
Get:11 https://packages.microsoft.com/repos/code stable/main amd64 Packages [25.8 kB]

Check candidates before install:

bash
apt-cache policy code code-insiders
text
code:
  Candidate: 1.126.0-1782208079
     1.126.0-1782208079 500
        500 https://packages.microsoft.com/repos/code stable/main amd64 Packages
code-insiders:
  Candidate: 1.127.0-1782234876
     1.127.0-1782234876 500
        500 https://packages.microsoft.com/repos/code stable/main amd64 Packages
HINT
Microsoft notes the Debian repo can lag the website download by up to three hours after a brand-new release. If apt-cache policy shows an older build, wait or use the direct .deb URL temporarily.

Step 2: Install VS Code (stable) from APT

bash
sudo apt-get install -y code

On my host the download was about 195 MB and finished with:

text
Fetched 195 MB in 44s (4,466 kB/s)
Unpacking code (1.126.0-1782208079) ...
Setting up code (1.126.0-1782208079) ...

Verify the package and on-disk version:

bash
dpkg -l code
python3 -c "import json; print(json.load(open('/usr/share/code/resources/app/package.json'))['version'])"
text
ii  code  1.126.0-1782208079  amd64  Code editing. Redefined.
1.126.0

The launcher lives at /usr/share/applications/code.desktop. The CLI wrapper is /usr/bin/code/usr/share/code/bin/code.


Step 3: Install VS Code Insiders from APT

Use the same repository—only the package name changes:

bash
sudo apt-get install -y code-insiders
text
Unpacking code-insiders (1.127.0-1782234876) ...
Setting up code-insiders (1.127.0-1782234876) ...

Insiders exposes a working --version on headless SSH where the stable Electron binary may exit without a display:

bash
code-insiders --version
text
1.127.0-insider
2858f2c0200dc2f4f87aca248c69daaf85f3ce69
x64

Launch Insiders from the app menu (Visual Studio Code - Insiders) or with code-insiders ..


Alternative: download and install the .deb package

When you cannot add apt sources (golden image policy, air-gapped transfer, or one-off VM), download VS Code for Ubuntu from Microsoft:

bash
cd ~/Downloads
wget -O code_amd64.deb https://update.code.visualstudio.com/latest/linux-deb-x64/stable

The redirect resolved to code_1.126.0-1782208079_amd64.deb when I checked headers.

For unattended installs that also register the Microsoft repo (so apt upgrade works later):

bash
echo "code code/add-microsoft-repo boolean true" | sudo debconf-set-selections
sudo apt install -y ./code_amd64.deb

Without that debconf line, the .deb postinst prompts whether to add the apt repository—fine in a desktop session, awkward in CI.


Alternative: Snap packages

Canonical hosts official Snap builds:

bash
sudo snap install code --classic
sudo snap install code-insiders --classic

snap info code listed a classic confinement package (~447 MB) in June 2026. Snap refreshes VS Code automatically in the background.

Remove with:

bash
sudo snap remove code
sudo snap remove code-insiders

Avoid installing Snap and APT stable builds together unless you want two separate “Visual Studio Code” icons.


First launch and daily use

Graphical: open the app menu → Visual Studio Code (stable) or Visual Studio Code - Insiders.

Open a project folder from the terminal:

bash
cd ~/projects/my-app
code .

For Insiders:

bash
code-insiders .

Install an extension from the CLI:

bash
code --install-extension ms-python.python

User settings, extensions, and caches live under ~/.config/Code (stable) or ~/.config/Code - Insiders. Sign in with a Microsoft or GitHub account from Accounts in the activity bar to sync settings when enabled.

Shell integration and default editor

After install, VS Code can install shell integration for bash/zsh when you run Terminal: Install Shell Integration from the Command Palette (Ctrl+Shift+P).

Set VS Code as the default plain-text editor (official Linux FAQ):

bash
xdg-mime default code.desktop text/plain
sudo update-alternatives --install /usr/bin/editor editor $(which code) 10
sudo update-alternatives --set editor /usr/bin/code

On Snap installs, use /snap/bin/code in the update-alternatives path instead.


Uninstall VS Code

APT stable:

bash
sudo apt-get purge -y code

APT Insiders:

bash
sudo apt-get purge -y code-insiders

A purge dry-run on stable reported:

text
The following packages will be REMOVED:
  code*
Purg code [1.126.0-1782208079]

Drop the repository when Microsoft updates are no longer wanted:

bash
sudo rm -f /etc/apt/sources.list.d/vscode.sources /usr/share/keyrings/microsoft.gpg

Delete local profile data only when you are sure:

bash
rm -rf ~/.config/Code ~/.vscode
rm -rf ~/.config/Code\ -\ Insiders ~/.vscode-insiders

Troubleshooting

Symptom Likely cause Fix
code: command not found after APT install PATH or wrong shell profile Use /usr/share/code/bin/code; open a new terminal
code opens Cursor or wrong binary Another IDE’s remote-cli/code earlier in PATH type code; call /usr/bin/code or adjust PATH order
Missing X server or $DISPLAY on SSH No GUI on server Use desktop locally, X forwarding, or Remote SSH from a workstation
Unable to watch for file changes (ENOSPC) inotify watch limit Raise fs.inotify.max_user_watches in /etc/sysctl.d/; exclude node_modules in settings
Wrong code package from distro PPA Pop!_OS or third-party repo Pin Microsoft origin in /etc/apt/preferences.d/code per Microsoft docs
Trash/delete fails in Explorer on Debian-based systems Missing gvfs sudo apt install gvfs libglib2.0-bin
sources.list.d/vscode.list: No such file during .deb install Missing directory sudo mkdir -p /etc/apt/sources.list.d
Repo origin changed error on apt update Microsoft metadata rotation Run sudo apt update and accept the prompt

References


Summary

To install VS Code on Ubuntu, add Microsoft’s signed packages.microsoft.com/repos/code source as vscode.sources, run sudo apt install code, and launch from the app menu or with code .. I verified stable 1.126.0 and Insiders 1.127.0 on Ubuntu 25.04. For a download VS Code Ubuntu workflow without a repo, grab the latest linux-deb-x64 .deb and pre-accept the repo with debconf-set-selections. Snap with --classic is the quickest one-liner when you already use Snap. Pick stable for everyday work and Insiders when you need tomorrow’s features—both uninstall cleanly with apt purge.


Frequently Asked Questions

1. How do I install VS Code on Ubuntu?

Import the Microsoft GPG key to /usr/share/keyrings/microsoft.gpg, add the packages.microsoft.com/repos/code deb822 source as /etc/apt/sources.list.d/vscode.sources, run sudo apt update, then sudo apt install code. Launch from the app menu or with the code command.

2. Is Visual Studio Code in the default Ubuntu apt repository?

No. Ubuntu archive packages named code are unrelated or absent on current releases. Install from Microsoft APT repo, the official .deb, or Snap. The must-have Ubuntu apps list on this site calls this out for Ubuntu 25.04.

3. What is the difference between VS Code and VS Code Insiders on Ubuntu?

Stable uses the code package and weekly tested releases. Insiders uses code-insiders with daily builds and newer features first. Both install from the same Microsoft repo; they can run side by side with separate config under ~/.config/Code and ~/.config/Code - Insiders.

4. How do I download VS Code for Ubuntu as a .deb file?

Get the latest amd64 build from code.visualstudio.com/download or wget the redirect URL from update.code.visualstudio.com/latest/linux-deb-x64/stable, then run sudo apt install ./code_*_amd64.deb. Pre-accept the Microsoft repo prompt with debconf-set-selections for non-interactive installs.

5. Should I install VS Code with apt or Snap on Ubuntu?

APT from packages.microsoft.com integrates with apt upgrade and matches Microsoft docs. Snap auto-updates in the background and needs --classic confinement. Pick one channel for daily use to avoid duplicate menu entries.

6. How do I install VS Code Insiders on Ubuntu?

After adding the Microsoft repo, run sudo apt install code-insiders. For Snap use sudo snap install code-insiders --classic. Launch with code-insiders from a terminal or the Insiders desktop entry.

7. Why does code open Cursor or fail with Missing X server on Ubuntu?

Remote IDE shims can shadow /usr/bin/code when VSCODE_IPC_HOOK_CLI is set—use /usr/share/code/bin/code explicitly. On SSH servers without a desktop, VS Code GUI needs a display or use code tunnel for remote access instead of launching the Electron window locally.

8. How do I uninstall VS Code from Ubuntu?

Run sudo apt purge code for the APT build, or sudo snap remove code for Snap. Remove /etc/apt/sources.list.d/vscode.sources and /usr/share/keyrings/microsoft.gpg when you no longer want Microsoft updates. Delete ~/.config/Code only when you do not need settings or extensions.
Deepak Prasad

R&D Engineer

Founder of GoLinuxCloud with over a decade of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive experience, he excels across development, DevOps, …

  • Red Hat Certified System Administrator in Red Hat OpenStack
  • Certified Kubernetes Application Developer (CKAD)
  • Red Hat Certified Specialist in Ansible Automation
  • Go (programming language)
  • Python (programming language)
  • DevOps
  • Computer Security