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.
| Method | Channel | Version | Updates | Best For |
|---|---|---|---|---|
| Microsoft APT Repository | Microsoft Repo | Stable, Insiders | Manual via apt upgrade | Direct Microsoft updates with traditional APT package management |
| Snap | Snapcraft | Stable, Insiders | Automatic | Hands-off updates with sandboxed installation |
| Flatpak | Flathub | Stable only | Manual via flatpak update | Cross-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
sudofor 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
.sourcesformat shown above. This format provides cleaner syntax and better maintainability compared to the legacy.listformat.
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
flatpakcommand 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:
- Click Activities at the top left corner of your screen to open the overview dashboard.
- Select Show Applications (the grid icon at the bottom of the dock).
- Type “Visual Studio Code” in the search bar. The VS Code icon appears as you type.
- 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 codestill shows a version table withInstalled: (none), runsudo apt purge codeto 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
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.
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).
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.
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.
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.
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
- VS Code Documentation: Official guides for configuration, keybindings, and advanced usage
- VS Code GitHub Repository: Source code, issue tracker, and release notes
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.
Formatting tips for your comment
You can use basic HTML to format your comment. Useful tags currently allowed:
<code>command</code>command<strong>bold</strong><em>italic</em><blockquote>quote</blockquote>