How To Install and Uninstall Visual Studio Code on Ubuntu 22.04

Updated: April 4, 2022

As we all know, Ubuntu just launched Beta version of Ubuntu 22.04 version with a lot of new features. So is installing new software like Visual Studio Code any different from old versions? This tutorial will show you several ways to install Visual Studio Code on Ubuntu 22.04.

What is Visual Studio Code - VSCode?

VSCode is a lightweight code editor, cross-platform, available on Windows, MacOS and Linux. It has built-in support for JavaScript, TypeScript, and Node.js, as well as any programming languages such as C++, Java, Python, … VSCode is a powerful editor because it has many extensions you can install to improve your productivity, it is a must-have tool every developer needs.

Prerequisites to install VSCode

  • Operating system: Ubuntu 22.04.
  • Account: Has sudo permissions.
  • If you want to install VSCode by using Snap Store, you must install Snap firstly.

Install Visual Studio Code on Ubuntu 22.04

Install VSCode on Ubuntu 22.04

VSCode is one of the most popular global code editors. Because of that, it has been provided a lot of ways so that anyone can install it easily on their Linux machine. This tutorial will give you three ways to achieve that. Choose the technique of installation that is best for your situation.

Option 1: Install Visual Studio Code using Ubuntu Center Software

If you’re using Ubuntu, Ubuntu Center Software should be your first choice before you want to install any applications. Following these steps to get this code editor.

Step 1: Open the Ubuntu Center Software

Open Ubuntu Software to install VSCode

Step 2: Search for Code Editor

Because the Ubuntu Software Center has a large number of packages, we must type Visual Studio Code into the search box to get the results.

Step 3: Start the installation

After all the search results appear, click on the first row, and then press the Install button to start the installation.

Option 2: Install VSCode using APT Ubuntu

This editor is developed by Microsoft Teams. They allow us to install Visual Studio Code from the offical Microsoft APT Repositories. Following these commands to install it:

Step 1: Update the Ubuntu packages index

Before we begin installing any applications, we must first update the packages index and install the dependencies need for that app by running the following commands:

sudo apt update
sudo apt install software-properties-common apt-transport-https wget

Step 2: Add Visual Studio Code repository to your Ubuntu

We’ll use the wget command to import the specified Microsoft GPG key into the terminal in this step:

wget –q https://packages.microsoft.com/key/microsoft.asc -O- | sudo apt-key add -

After that, we will need to enable VSCode repository:

sudo add-apt-repository "deb [ach=amd64] https://packages.microsoft.com/repos/vscode stable main"

Step 3: Install Visual Studio Code package

Whenever a repository is added to the system. The final step is to run the installation command for the Visual Studio Code package, which is mentioned below:

sudo apt install code

Option 3: Install VSCode using Snap Store

Snap is a collection of apps and their dependencies that run on a variety of Linux distributions without needing to be modified. Therefore, you can easily install VSCode on Ubuntu 22.04 by using Snap.

Executing commands through the terminal provides us with a quick way to do anything, including using Snap’s utilities. So, I think you should install this code editor by using command after open terminal:

sudo snap install --classic code

After the process installation is finished, It means the Visual Studio Code is installed successfully on your Ubuntu machine.

Launch Visual Studio Code

After installing VSCode, you can now open this application by searching Visual Studio Code in Activities and click its icon to launch. When you open it, a window like this appear:

Launching Visual Studio Code on Ubuntu 22.04

Uninstall VSCode on Ubuntu 22.04

Same as the installation process, the uninstall process is also easy. To uninstall Visual Studio Code on your Linux machine, you can run this command to uninstall the program:

sudo apt purge code

Then, we will need to run this command remove all shortcuts, menu items, …

sudo apt autoremove

Conclusion

In this tutorial, I introduced ways to install Visual Code Studio on Ubuntu 22.04, and I also help to uninstall it too. Keep in mind that, this tutorial is also available for older Ubuntu versions. Please do not hesitate to contact me if you have any questions.