How to Install VSCode on Ubuntu 22.04 | 20.04

Visual Studio Code is a free and powerful source-code editor made by Microsoft for various operating systems, which include Linux, and works well on Ubuntu-based systems. VSCode offers many features such as support to debug applications, embedded Git control which helps you with code completion or refactoring when needed, plus much more. Another part that VSCode is popular with is that you can find extensions in the extensive library that will further enhance your software development experience – all at no cost whatsoever; thanks also to being able through its continuously updated extension model to make sure those updates come quickly, so there are never any downtime periods.

In the following tutorial, you will learn how to Install Visual Code Editor (VS CODE) Ubuntu 22.04 LTS Jammy Jellyfish and Ubuntu 20.04 LTS Focal Fossa using the command line terminal to import the Microsoft official repository and gpg key and install the IDE editor, with full instructions for the standard stable version, along with the Visual Studio code insiders and exploration branches.

Recommended Steps Before Installation

Before you begin, run an update on your system to ensure all packages are up-to-date to avoid any conflicts during the installation.

sudo apt update

Optionally, you can list the updates for users who require review or are curious.

sudo apt --list upgradable

Proceed to upgrade any outdated packages using the following command.

sudo apt upgrade

Install Visual Studio Code

Install Required Packages

The following packages must be installed to assist in installing the software.

sudo apt install dirmngr software-properties-common apt-transport-https curl -y

These are the most common software packages found on nearly all Linux distributions.

Import Visual Studio Code Repository

Next, you will need to import the Microsoft GPG key to verify the authenticity of the installation package.

curl -fSsL | sudo gpg --dearmor | sudo tee /usr/share/keyrings/vscode.gpg > /dev/null

Secondly, import the Microsoft Visual Source Repository with the following command in your terminal.

echo deb [arch=amd64 signed-by=/usr/share/keyrings/vscode.gpg] stable main | sudo tee /etc/apt/sources.list.d/vscode.list

Install Visual Studio Code (VSCode)

With the source repository sorted, you must refresh your apt package manager sources list to reflect the new addition before the Visual Studio installation.

Run the following command in your terminal to reflect the newly added repository.

sudo apt update

Now install Visual Studio stable, recommended, or optionally install insiders or exploration as per below for users familiar with those versions.

Install VSCode stable build

sudo apt install code -y

Install VSCode insiders build

sudo apt install code-insiders -y

Install VSCode exploration build

sudo apt install code-exploration -y

Launch Visual Studio Code

Now that you have completed the installation, you can open the software in a few ways.

Using the command line terminal, you can open the software quickly by using the following command.


The best way to use VSCode for desktop users that prefer not to use the command line terminal is to open the GUI of the application by following the path.

Activities > Show Applications > Visual Studio Code


Once open, you can begin to use the IDE. In the future, all updates will be handled using the APT update command that is used to update all your other packages on your system, so you should always be up-to-date with the latest version of whichever version you install.

See also
How to Install Python Pip on Ubuntu 22.04 or 20.04


Congratulations, you have installed Microsoft Visual Studio Code.

Remove Visual Studio Code

Removing VSCode is straightforward; use the command that matches your installation.

Remove VSCode stable build

sudo apt remove code --purge

Note that the –purge flag removes all data created with VSCode.

Remove VSCode insider’s build

sudo apt remove code-insiders --purge

Remove VSCode exploration build

sudo apt remove code-exploration --purge

Next, remove the repository using the following command.

sudo rm /etc/apt/sources.list.d/vscode.list

For good housekeeping and security, remove the GPG key as follows.

sudo rm /usr/share/keyrings/vscode.gpg

Leave a Comment

Share to...