How to Install vscode on Ubuntu

May 12, 2022


Microsoft's Visual Studio Code (vscode) is a source-code editor developed for Windows, Linux, and macOS. The code editor supports debugging, syntax highlighting, automatic code completion, snippets, embedded Git control, etc.

vscode is open source. It supports an abundance of extensions acts as a version control system, thus facilitating project collaboration.

In this tutorial, you will learn to install, uninstall, and start vscode on Ubuntu.

How to install vscode on Ubuntu.


  • A system running Ubuntu.
  • An account with administrator privileges.
  • A working network connection.

How to Install vscode on Ubuntu?

There are three ways to install vscode on Ubuntu:

  • Installing the snap package.
  • Using the apt package manager.
  • Via the Ubuntu Software GUI app.

Choose an installation method and follow the steps below to install vscode.

Method 1: Install Visual Studio Code with Snap

Snap packages are containerized applications. Open the terminal and run the following command to install the vscode self-contained snap package with the required dependencies:

sudo snap install --classic code
Installing vscode on ubuntu via the snap package.

Verify the installation by checking the program version:

code --version
Checking the vscode program version on Ubuntu.

Method 2: Install Visual Studio Code with apt

Another way to install vscode is via the apt package manager. Follow the steps below to install vscode using apt:

Note: Read our Snap vs. apt article to see how the Snap packaging system compares to the apt package manager.

Step 1: Update the system repository

Run the following command to update the system's repository and ensure you get the latest vscode version:

sudo apt update

Step 2: Install Package Dependencies

For proper operation, vscode requires you to install package dependencies. Run the following command to resolve package dependencies:

sudo apt install software-properties-common apt-transport-https wget -y
Installing package dependencies for vscode on Ubuntu.

The command automatically installs any vscode dependencies.

Step 3: Add GPG Key

Import the GPG key provided by Microsoft to verify the package integrity. Enter:

wget -q -O- | sudo apt-key add -
Adding a GPG key from Microsoft to verify the vscode package integrity.

Step 4: Add Repository

Run the following command to add the Visual Studio Code repository to your system:

sudo add-apt-repository "deb [arch=amd64] stable main"
Adding the vscode repository to ubuntu before installation.

Note: See how to troubleshoot the Add-apt-repository command not found error.

Step 5: Install vscode

After enabling the repository, install vscode by running:

sudo apt install code
Installing vscode using the apt package manager.

Step 6: Verify Installation

Verify vscode installation by running:

code --version

If the installation was successful, the output shows the program version.

Note: Learn how to use Docker for Visual Studio Code.

Method 3: Install Using the GUI

Follow the steps below to install vscode using Ubuntu Software Center:

1. Open Ubuntu Software Center

Click the Show Applications button and open the Ubuntu Software Center app.

Opening the Ubuntu Software app.

Note: The Show Applications button opens the app drawer and shows installed app icons. See how to list installed apps using the terminal.

2. Find Visual Studio Code

Click the Search button, and type vscode in the search bar. Click code on the list to open the app page.

Searching for vscode in the Ubuntu Software application.

3. Install vscode

Click the Install button and, when prompted, type in your administrator password to start the installation.

Installing vscode on Ubuntu using the GUI Ubuntu Software Center app.

How to Start vscode on Ubuntu?

Click the Show Applications button and locate Visual Studio Code in the app list.

Opening Visual Studio Code on Ubuntu.

Click the app to open it and start customizing the appearance, adding extensions for the programming languages you need, etc.

Getting started with vscode on Ubuntu.

Uninstall vscode

Depending on the installation method, use on of three ways to uninstall vscode:

1. For vscode installations using snap (method 1):

Remove the vscode snap app by running the following command:

sudo snap remove code
Uninstalling the vscode snap package from Ubuntu.

The command removes vscode and notifies you of the result.

2. For vscode installations using apt package manager (method 2):

if you installed vscode via apt, uninstall the program by running:

sudo apt remove code
Uninstalling the vscode app using the apt package manager.

3. For vscode installations using the GUI (method 3):

If you installed vscode via the Ubuntu Software Center, follow the steps below uninstall the app:

1. Open the Ubuntu Software Center and click the Installed tab to see all installed apps.

2. Locate the code app on the list and click the Remove button.

Listing installed apps using the Ubuntu Software Center app.

4. When prompted, click Remove one more time to uninstall vscode from the system. Provide the admin password to confirm you want to uninstall the app.

Uninstalling vscode from the Ubuntu Software Center.

The app has been successfully removed from your system.


This guide showed you how to install and uninstall vscode on Ubuntu using three methods. Choose your preferred installation method and start creating and editing code easily with vscode.

Next, read up on the best Python IDEs and code editors, or see our list of 22 best Linux text editors for programming and coding.

Was this article helpful?
Bosko Marijan
Having worked as an educator and content writer, combined with his lifelong passion for all things high-tech, Bosko strives to simplify intricate concepts and make them user-friendly. That has led him to technical writing at PhoenixNAP, where he continues his mission of spreading knowledge.
Next you should read
13 Best Java IDEs - Pros and Cons
November 10, 2021

Java IDE bundles all the useful tools for writing, debugging, and testing your Java code. Take a look at the best Java IDEs you can use.
Read more
How to Install and Use Nano in Linux
March 25, 2024

Nano is a simple, modeless, WYSIWYG command-line text editor. In this tutorial, learn how to install and use the Nano text editor.
Read more
How To Install Vim 8.2 on Ubuntu 18.04
September 29, 2022

VIM, known as the programmer’s editor, is highly configurable and customizable. In this tutorial, we learn how to install VIM editor on Ubuntu.
Read more
How to Save a File in Vi / Vim & Exit
September 22, 2022

Vim is an open-source text editor for Linux or Unix systems. Follow this guide and learn how to open, save and exit a file in Vi/Vim.
Read more