Visual Studio Code is an optimized, feature-rich code editor for building web and cloud applications, which is developed by Microsoft. It includes features like embedded Git, supports debugging, syntax highlighting, intelligent code completion, snippets, and code refactoring.

The Visual Studio Code is freely available for most modern operating systems like Windows, Linux (RPM and Debian installations are also available), and macOS.

This tutorial will help you to install Visual Studio Code on Ubuntu 22.04 LTS Linux system using Apt package manager and using snap package.

Prerequisites

In order to install VS Code, you must have sudo privileges or root account access to the Ubuntu 22.04 system.

Installing Visual Studio Code on Ubuntu

Visual Studio Code is available as the Snap package as well official apt repository with the Debian package. Choose one of the below methods as per your choice.

Method 1: Install VS Code Using Apt Repository

Follow the below steps to install Visual Studio Code on Ubuntu from the official Apt repository.

  1. First of all, execute the following commands to import the GPG key to the system that is used to verify packages before installation:
    curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg 
    sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg 
    
  2. Microsoft official provides an Apt repository for the installation of VS Code on Debian-based systems. To enable the Visual Studio code Apt repository, type:
    echo "deb [arch=amd64] http://packages.microsoft.com/repos/vscode stable main" | sudo 
       tee /etc/apt/sources.list.d/vs-code.list 
    
  3. Once you successfully added the repository to your system, Execute the following commands to install Visual Studio Code on the Ubuntu system.
    sudo apt update 
    sudo apt install code 
    

    Press ‘y’ for any confirmation prompted by the installer.

The above steps will complete the VS Code installation on a Ubuntu system.

Rather than above steps, you can also install VS Code from Snapcraft. The installation instructions are below:

Method 2: Install VS Code Using Snap Package

The Ubuntu 22.04 already have installed Snapd service. You can directly install the Visual Studio Code on a Ubuntu system with the below-mentioned command:

sudo snap install code --classic 

The above command will download the latest VS Code snap package and install it on your system. Once the installation is completed successfully, you will see the following output.

How to Install Visual Studio Code on Ubuntu 22.04 IDE linux text editor text editor Visual Studio Code
Installing Visual Studio Code using Snap

That’s it. The Visual Studio Code snap package has been successfully installed on your system.

Using the Visual Studio Code

Now, The Visual Studio Code has been installed on your Ubuntu 20.04 system. To launch the application type “code” in the search application and click on it.

How to Install Visual Studio Code on Ubuntu 22.04 IDE linux text editor text editor Visual Studio Code
Access Visual Studio Code Application

The Visual Studio Code editor is ready to use.

How to Install Visual Studio Code on Ubuntu 22.04 IDE linux text editor text editor Visual Studio Code
Running Visual Studio Code on Ubuntu

The Visual Studio Code provides you with a large number of extensions that extends functionality like C#, Python, JavaScript, Google Chrome, etc. Install the required extensions to enhance your working experience with the Visual Studio Code.

Upgrade Visual Studio Code on Ubuntu

The VS Code team is actively developing the application. So you will receive security packages, features, or a full software upgrade from time to time. It’s recommended to upgrade VS Code:

  • If you have installed VS Code from Apt repository, execute the following commands:
    sudo apt update && sudo apt install code 
    
  • Snapd users not to worry about manual upgrades. The service automatically upgrade the packages in background.

Delete (Remove) Visual Studio Code

  • The users have installed VS code from Apt repository can remove packages with the following commands:
    sudo apt remove --purge code 
    sudo apt auto-remove 
    
  • The snap package can be removed with the following command:
    sudo snap remove code 
    

Conclusion

In this tutorial, you have learned two steps for the installation of Visual Studio Code on a Ubuntu 22.04 LTS Linux system.