How to Install VS Code on Ubuntu 22.04: A Step-by-Step Guide

This guide will walk you through the steps of installing Visual Studio Code on Ubuntu 22.04, following the official recommended way.

Visual Studio Code (often abbreviated as VS Code) is a free, cross-platform, and open-source code editor developed by Microsoft that is available for Windows, Linux, and macOS.

The combination of a lightweight editor and powerful functionality has contributed to VS Code’s rise as one of the most popular integrated development environment (IDE) tools in recent years.

Its key features include syntax highlighting, built-in debugging support, embedded Git control, code completion, an integrated terminal, snippets, and code refactoring.

This guide will walk you through the steps for installing Visual Studio Code on your Ubuntu 22.04 system using the officially approved method.

In addition, we will also show you how to install it as a Snap package, a software distribution format recommended and enforced by Ubuntu. So, let’s get started!

Install Visual Studio Code on Ubuntu 22.04

The methods below show how to install Visual Studio Code on Ubuntu from the official Microsoft repository.

1. Install Prerequisites

Before we begin the installation, we must first install some packages that will be required to be available on our Ubuntu 22.04 system for the next steps. To accomplish this, type:

sudo apt install software-properties-common apt-transport-https wget gpg
Install Prerequisites

2. Import Microsoft’s GPG Key

Next, to ensure that the packages we receive to install the Visual Studio Code are genuine, we should download and import the Microsoft signed GPG keys on our Ubuntu 22.04 system.

To do so, type the following commands:

wget -qO- | gpg --dearmor >
sudo install -D -o root -g root -m 644 /etc/apt/keyrings/ language: JavaScript (javascript)
Import Microsoft's GPG Key

3. Add Microsoft’s Visual Studio Code Repository

After importing the GPG keys, we’ll add the official Visual Studio Code repository to our Ubuntu 22.04 system. This implies that the update package will be made available with the rest of your system’s regular updates if a new version is released.

To accomplish it, type the command shown below.

sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/] stable main" > /etc/apt/sources.list.d/vscode.list'Code language: JavaScript (javascript)
Add Microsoft's Visual Studio Code Repository

4. Run System Update

Before we proceed with VS Code installation on our Ubuntu 22.04 system, we should update the list of available packages. So, run the below command to update the APT repositories index.

sudo apt update
Run System Update

As you can see, our new Microsoft Visual Studio Code repository is now available and ready to be used.

5. Install VS Code on Ubuntu 22.04

Everything is already prepared for the actual installation. Now, to install VS Code on Ubuntu 22.04, run the following commands:

sudo apt install code
Install VS Code on Ubuntu 22.04

6. Run Visual Studio Code on Ubuntu 22.04

You can start using VS Code by launching it from the desktop application menu. Search for “code,” and when its icon appears, click to run the same.

Run Visual Studio Code on Ubuntu 22.04

When you start VS Code for the first time, a window like the following should appear:

Visual Studio Code App

 Install Visual Studio Code with Snap

Snap is an approach to distributing software encapsulated in a Snap package that offers compatibility in its use between various Linux distributions.

Since Snap is a technology developed by Canonical, the company behind Ubuntu, it is not surprising that it is attempting to force the usage of Snap packages.

However, Snap packages have some drawbacks, one being speed compared to applications installed natively from a DEB package.

The entire process of installing Visual Studio Code as a Snap package on Ubuntu 22.04 is wrapped in the execution of a single command. So if you want to install it from a Snap package, run:

sudo snap install --classic code
Install Visual Studio Code with Snap

That’s all. The application can then be run as outlined in the previous section.

However, if you are not comfortable with the command line, you can achieve the same result by installing VS Code as a Snap package through Ubuntu’s graphical applications manager.

Run the Ubuntu Software app and search for “code,” then select it from the results list.

Install Visual Studio Code as a Snap Package on Ubuntu 22.04

Next, click the “Install” button to install Visual Studio Code as a Snap package.

Install Visual Studio Code as a Snap Package on Ubuntu 22.04


This guide showed how to install Visual Studio Code on Ubuntu 22.04 using two techniques: a native DEB application and a Snap package. Which option you choose is dependent entirely on your personal preferences.

If you have any questions, please leave them in the comments section below. To learn more about Visual Studio Code, visit their official documentation page.

Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

Think You're an Ubuntu Expert? Let's Find Out!

Put your knowledge to the test in our lightning-fast Ubuntu quiz!
Ten questions to challenge yourself to see if you're a Linux legend or just a penguin in the making.

1 / 10

Ubuntu is an ancient African word that means:

2 / 10

Who is the Ubuntu's founder?

3 / 10

What year was the first official Ubuntu release?

4 / 10

What does the Ubuntu logo symbolize?

5 / 10

What package format does Ubuntu use for installing software?

6 / 10

When are Ubuntu's LTS versions released?

7 / 10

What is Unity?

8 / 10

What are Ubuntu versions named after?

9 / 10

What's Ubuntu Core?

10 / 10

Which Ubuntu version is Snap introduced?

The average score is 68%