How to Install Visual Studio Code on Ubuntu (26.04, 24.04, 22.04)

Last updated Thursday, February 26, 2026 12:34 pm Joshua James 9 min read

Visual Studio Code (VS Code) is a free code editor from Microsoft built for Python development, web frameworks, and remote container workflows. It combines intelligent code completion (IntelliSense), integrated debugging, built-in Git version control, and an extension marketplace with thousands of plugins. Ubuntu does not include VS Code in its default repositories. You can install Visual Studio Code on Ubuntu through three methods covered below, ending with a verified, working editor ready for development.

Choose Your Visual Studio Code Installation Method on Ubuntu

Visual Studio Code offers three installation paths on Ubuntu, each with distinct trade-offs. Choose based on your update preferences, system integration needs, and whether you require the Insiders build for early access to experimental features.

MethodChannelVersionUpdatesBest For
Microsoft APT RepositoryMicrosoft RepoStable, InsidersManual via apt upgradeDirect Microsoft updates with traditional APT package management
SnapSnapcraftStable, InsidersAutomaticHands-off updates with sandboxed installation
FlatpakFlathubStable onlyManual via flatpak updateCross-distribution compatibility with application sandboxing

For most users, the Microsoft APT repository is recommended because it provides direct upstream packages and integrates with Ubuntu’s standard update workflow. Snap offers convenience through automatic updates, while Flatpak prioritizes cross-distribution compatibility but lacks the Insiders build.

The Microsoft repository uses a universal package format that works on all current Ubuntu releases, including LTS versions and interim releases. Commands shown in this guide work identically regardless of your specific Ubuntu version.

Method 1: Install VS Code via Microsoft APT Repository on Ubuntu

Update Ubuntu System Packages

Before installing Visual Studio Code, refresh your package index and upgrade any outdated packages:

sudo apt update && sudo apt upgrade

This guide uses sudo for commands that need root privileges. If your user account lacks sudo access, see our guide on how to add and manage sudo users on Ubuntu.

Install Required Dependencies for VS Code

Install packages needed for secure GPG key downloads and repository management. The -y flag automatically confirms the installation prompt:

sudo apt install curl gpg -y

Add Microsoft VS Code Repository

Download Microsoft’s GPG signing key and convert it to binary format:

curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft.gpg

This command downloads the ASCII-armored key, converts it to binary format using gpg --dearmor, and writes it directly to the system keyring directory. The -fsSL flags ensure curl fails silently on server errors, shows no progress bar, follows redirects, and uses HTTPS. For more download techniques, see our curl command guide.

Create the repository configuration file using the modern DEB822 format:

echo "Types: deb
URIs: https://packages.microsoft.com/repos/code
Suites: stable
Components: main
Architectures: amd64 arm64 armhf
Signed-By: /usr/share/keyrings/microsoft.gpg" | sudo tee /etc/apt/sources.list.d/vscode.sources > /dev/null

Ubuntu 26.04 LTS, 24.04 LTS, and 22.04 LTS all support the modern DEB822 .sources format shown above. This format provides cleaner syntax and better maintainability compared to the legacy .list format.

Install Visual Studio Code

With the repository configured, refresh your package list to recognize the newly added repository:

sudo apt update

Verify that APT recognizes the Microsoft repository:

apt-cache policy code

Expected output showing the Microsoft repository:

code:
  Installed: (none)
  Candidate: 1.x.x-xxxxxxxxxx
  Version table:
     1.x.x-xxxxxxxxxx 500
        500 https://packages.microsoft.com/repos/code stable/main amd64 Packages

Now, install the stable build of Visual Studio Code:

sudo apt install code

Alternatively, install the Insiders build for early access to experimental features:

sudo apt install code-insiders

Verify VS Code APT Installation

After installation completes, verify that VS Code is accessible by checking its version:

code --version

Expected output:

1.x.x
abcdef1234567890abcdef1234567890abcdef12
x64

Method 2: Install VS Code via Snap on Ubuntu

Install Snap Package Manager on Ubuntu

Snap provides automatic background updates for VS Code. Ubuntu includes Snap by default, but verify it is installed:

sudo apt install snapd

Install VS Code Using Snap

Once snapd is ready, install Visual Studio Code:

sudo snap install code --classic

Alternatively, for the Insiders build:

sudo snap install code-insiders --classic

The --classic flag grants VS Code full access to your filesystem, which is necessary for reading project files, accessing terminals, and running debuggers. Without this flag, the sandboxed environment would prevent VS Code from functioning as a development tool.

Verify VS Code Snap Installation

After installation completes, verify that VS Code is accessible:

snap list code

Expected output:

Name  Version   Rev    Tracking       Publisher   Notes
code  xxxxxxxx  xxx    latest/stable  vscode**    classic

Method 3: Install VS Code via Flatpak on Ubuntu

Add Flathub Repository for VS Code

Flatpak provides cross-distribution compatibility with application sandboxing. If Flatpak is not installed on your system, follow our Flatpak installation guide on Ubuntu to set up the Flatpak framework and Flathub repository. Once ready, add the Flathub repository:

sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

The --if-not-exists flag prevents errors if Flathub is already configured.

Flatpak is not pre-installed on Ubuntu. Ubuntu 26.04 LTS, 24.04 LTS, and 22.04 LTS all require manual installation of Flatpak and the Flathub repository before you can install Flatpak applications. If the flatpak command is not found, complete our prerequisite guide linked above first.

Install VS Code Using Flatpak

With Flathub configured, install Visual Studio Code from the repository:

sudo flatpak install flathub com.visualstudio.code -y

This command installs Visual Studio Code system-wide for all users. The -y flag automatically confirms the installation prompt, and sudo ensures the Flatpak package installs at system scope, consistent with the system-level Flathub remote added above.

Verify VS Code Flatpak Installation

After installation completes, verify that VS Code is installed correctly:

flatpak info com.visualstudio.code

Expected output:

Visual Studio Code - Code Editing. Redefined.

          ID: com.visualstudio.code
         Ref: app/com.visualstudio.code/x86_64/stable
        Arch: x86_64
      Branch: stable
     Version: 1.x.x
      Origin: flathub
Installation: system

Launch Visual Studio Code on Ubuntu

Launch VS Code from Terminal

Launch Visual Studio Code from the terminal using the command that matches your installation method:

APT installation (stable):

code

APT installation (Insiders):

code-insiders

Snap installation:

snap run code

Flatpak installation:

flatpak run com.visualstudio.code

You can also open a specific file or folder by appending the path to the command, for example: code ~/projects/myapp.

Launch VS Code from Applications Menu

Alternatively, to launch Visual Studio Code using Ubuntu’s graphical interface:

  1. Click Activities at the top left corner of your screen to open the overview dashboard.
  2. Select Show Applications (the grid icon at the bottom of the dock).
  3. Type “Visual Studio Code” in the search bar. The VS Code icon appears as you type.
  4. Click the icon to launch VS Code.

Update Visual Studio Code on Ubuntu

Update VS Code via APT Repository

When using the APT installation method, Visual Studio Code updates arrive through Ubuntu’s standard package update process. To update, refresh your package list and upgrade:

sudo apt update && sudo apt upgrade

This command upgrades all system packages including VS Code. Alternatively, to upgrade only VS Code specifically:

sudo apt update && sudo apt install --only-upgrade code

Update VS Code via Snap

When using Snap, the system handles updates automatically in the background. However, you can force an immediate update check:

sudo snap refresh code

For the Insiders build:

sudo snap refresh code-insiders

Update VS Code via Flatpak

For Flatpak installations, update Visual Studio Code through Flatpak’s update mechanism:

sudo flatpak update com.visualstudio.code -y

Alternatively, you can update all Flatpak applications at once:

sudo flatpak update -y

Remove Visual Studio Code from Ubuntu

Remove VS Code via APT

If you installed Visual Studio Code via APT, remove the stable build:

sudo apt remove code

For the Insiders build:

sudo apt remove code-insiders

VS Code’s package automatically removes the repository file (/etc/apt/sources.list.d/vscode.sources) and GPG key (/usr/share/keyrings/microsoft.gpg) during uninstallation. Clean up any remaining orphaned dependencies:

sudo apt autoremove

Verify removal by refreshing the package cache and confirming VS Code is no longer available:

sudo apt update
apt-cache policy code

Expected output after complete removal:

N: Unable to locate package code

If apt-cache policy code still shows a version table with Installed: (none), run sudo apt purge code to fully remove residual configuration data, then repeat the verification.

Remove VS Code via Snap

For Snap installations, remove Visual Studio Code with the following command:

sudo snap remove code

For the Insiders build:

sudo snap remove code-insiders

Remove VS Code via Flatpak

For Flatpak installations, use this command:

sudo flatpak uninstall com.visualstudio.code

Optionally, remove unused Flatpak runtimes to free disk space:

sudo flatpak uninstall --unused -y

Remove VS Code User Data

The following commands permanently delete your VS Code settings, extensions, and cached data. If you want to preserve your configuration for future reinstallation, back up these directories first: cp -r ~/.config/Code ~/vscode-backup.

After uninstalling VS Code, you can optionally remove user data directories that contain settings, extensions, and cache:

rm -rf ~/.config/Code ~/.cache/Code ~/.local/share/Code ~/.vscode

For Flatpak installations, user data is stored separately:

rm -rf ~/.var/app/com.visualstudio.code

For Insiders builds, remove the corresponding directories:

rm -rf ~/.config/Code\ -\ Insiders ~/.cache/Code\ -\ Insiders ~/.local/share/Code\ -\ Insiders ~/.vscode-insiders

Frequently Asked Questions about VS Code on Ubuntu

Is Visual Studio Code available in Ubuntu’s default repositories?

No. Ubuntu’s default repositories do not include Visual Studio Code. Microsoft distributes VS Code through its own APT repository, Snap Store, and Flathub. To install via APT, you must add Microsoft’s repository and GPG signing key manually.

What is the difference between VS Code Snap and APT installation on Ubuntu?

The APT method installs packages directly from Microsoft’s repository and updates through standard apt upgrade commands. The Snap method installs a sandboxed package that updates automatically in the background. APT provides both Stable and Insiders builds, while Snap also offers both. The main trade-off is manual update control (APT) versus automatic updates (Snap).

Does VS Code automatically remove its APT repository when uninstalled?

Yes. The VS Code .deb package includes a post-removal script that deletes both the repository file (/etc/apt/sources.list.d/vscode.sources) and the GPG signing key (/usr/share/keyrings/microsoft.gpg) when you run apt remove code. No manual cleanup of these files is needed.

Can I run VS Code Stable and Insiders builds at the same time on Ubuntu?

Yes. The Stable build installs as the code package and the Insiders build installs as code-insiders. Both use separate binaries, configuration directories, and desktop entries, so they run independently without conflicts.

What is the official way to install Visual Studio Code on Ubuntu?

Microsoft recommends adding their APT repository at packages.microsoft.com, which provides direct upstream .deb packages that update through standard apt upgrade commands. This is the method documented on Microsoft’s official VS Code Linux setup page. Snap and Flatpak are supported alternatives, but the APT repository provides the most direct upstream integration.

Does Visual Studio Code have a PPA for Ubuntu?

No. Microsoft does not maintain a PPA (Personal Package Archive) on Launchpad. Instead, Microsoft hosts its own APT repository at packages.microsoft.com/repos/code. This repository serves the same purpose as a PPA, delivering direct upstream packages through APT, but is hosted on Microsoft’s infrastructure rather than Launchpad.

Official Visual Studio Code Resources

Conclusion

Visual Studio Code is running on your Ubuntu system with IntelliSense, integrated debugging, and access to the full extension marketplace. Whether you chose the APT repository for direct upstream control, Snap for hands-off updates, or Flatpak for cross-distribution compatibility, the editor is ready for development. For a complete environment, consider installing Git on Ubuntu for version control, setting up Node.js on Ubuntu for JavaScript development, installing Docker on Ubuntu for container-based workflows, or configuring unattended upgrades on Ubuntu to keep your system secure automatically.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffee Buy me a coffee

Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Leave a Comment

We read and reply to every comment - let us know how we can help or improve this guide.

Let us know you are human: