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.
- 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
Verify the installation by checking the program version:
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
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 https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
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] https://packages.microsoft.com/repos/vscode stable main"
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
Step 6: Verify Installation
Verify vscode installation by running:
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.
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.
3. Install vscode
Click the Install button and, when prompted, type in your administrator password to start the installation.
How to Start vscode on Ubuntu?
Click the Show Applications button and locate Visual Studio Code in the app list.
Click the app to open it and start customizing the appearance, adding extensions for the programming languages you need, etc.
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
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
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.
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.
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.