Visual Studio Code is a free source-code editor made by Microsoft for Windows, Linux macOS. Visual Studio Code features include support for debugging, embedded Git control, intelligent code completion, snippets, and code refactoring. Microsoft Visual Studio Code also has an extensive extension library that can further support dedicated software development and coding to enrich and help develop and use the software.
In the following guide, you will learn how to install Visual Code Editor on Pop!_OS 20.04.
Table of Contents
Prerequisites
- Recommended operating system: Pop!_OS 20.04 or higher.
- User Account: A user account with sudo or root access.
- Internet access
Update the operating system
Update your Pop!_OS operating system to make sure all existing packages are up to date:
sudo apt update && sudo apt upgrade
The tutorial will use the sudo command and assume you have sudo status.
To check the sudo status on your account:
sudo whoami
Example output showing the sudo state:
[joshua@popos ~]$ sudo whoami
root
To set up an existing or new sudo account, visit our tutorial on adding a User to Sudoers on Pop!_OS.
To use the root account, use the following command with the root password to log in.
su
The tutorial will use the terminal for installation found in Activities> Show Applications > Terminal.
Example:
Import GPG Key and Visual Studio Repository
First, you will need to import the Microsoft GPG key to verify the authenticity of the installation package:
curl -sSL https://packages.microsoft.com/keys/microsoft.asc -o microsoft.asc
gpg --no-default-keyring --keyring ./ms_signing_key_temp.gpg --import ./microsoft.asc
gpg --no-default-keyring --keyring ./ms_signing_key_temp.gpg --export > ./ms_signing_key.gpg
sudo mv ms_signing_key.gpg /etc/apt/trusted.gpg.d/
Example output if successful:
gpg: key EB3E94ADBE1229CF: public key "Microsoft (Release signing) <gpgsecurity@microsoft.com>" imported
gpg: Total number processed: 1
gpg: imported: 1
Secondly, import the Microsoft Visual Source Repository with the following command your terminal:
echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" | sudo tee /etc/apt/sources.list.d/vscode.list
Install Visual Studio Code
With the source repository sorted, you must refresh your apt package manager sources list to reflect the new addition before the Visual Studio installation. To do this, run the following command in your terminal:
sudo apt update
Now install Visual Studio with the following command:
sudo apt install code
To confirm the installation, you can use the verify version command as follows:
code --version
Example output:
1.63.2
899d46d82c4c95423fb7e10e68eba52050e30ba3
x64
How to Launch Visual Studio Code
With the installation complete, you can run Visual Studio in a few different ways. First, while you are in your terminal, you can use the following command:
code
Alternatively, run the code command in the background to free up the terminal:
code &
However, this isn’t practical, and you would use the following path on your Pop!_OS desktop to open with the path: Taskbar > Applications > Accessories > Visual Studio Code.
If you cannot find it, use the search function in the Show Applications menu if you have many applications installed.
Example:
The first time you open Visual Studio, you will see the following window.
Example:
Select the theme you want. Dark is the default and is the most popular. Click Mark Done on the bottom left-hand side.
Once done, you will be taken to the default opening window.
Example:
Congratulations, you have installed Microsoft Visual Studio Code on Pop!_OS 20.04.
How to Remove (Uninstall) Visual Studio Code
To remove the Visual Studio software from your system, run the following command in your terminal:
sudo apt remove code --purge
Then for complete removal, delete the repository and GPG key:
sudo rm /etc/apt/sources.list.d/vscode.*
sudo rm /etc/apt/trusted.gpg.d/ms_signing_key.gpg
sudo apt update
Comments and Conclusion
The guide has shown you how to install Microsoft Visual Code for Pop!_OS 20.04 and add the repository to update the program without manually re-downloading and installing.
Visual Code is one of the most used free IDE editors on the planet. It is also lightweight and an excellent option for your system if you run services and servers instead of using the default Linux text editors such as vim or nano.