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 Linux Mint 20.
Table of Contents
- Recommended OS: Linux Mint 20 or higher.
- User account: A user account with sudo or root access.
Update Operating System
Update your Linux Mint operating system to make sure all existing packages are up to date:
sudo apt update && sudo apt upgrade -y
The tutorial will be using the sudo command and assuming you have sudo status. To verify sudo status on your account:
Example output showing sudo status:
[[email protected] ~]$ sudo whoami root
If you have not set up a sudo user account and would like to, visit our tutorial on How to Add a User to Sudoers on Linux Mint.
To use the root account, use the following command with the root password to log in.
Install Dependencies for Installation
To install Visual Studio, you will need to make sure the following packages are installed. Run the following command to verify or install the packages:
sudo apt install software-properties-common apt-transport-https curl -y
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: keybox './ms_signing_key_temp.gpg' created gpg: /home/joshua/.gnupg/trustdb.gpg: trustdb created gpg: key EB3E94ADBE1229CF: public key "Microsoft (Release signing) <[email protected]>" 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:
1.60.2 7f6ab5485bbc008386c4386d08766667e155244e 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:
Alternatively, run the code command in the background to free up the terminal:
However, this isn’t practical, and you would use the following path on your Linux Mint 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.
The first time you open Visual Studio, you will see the following window:
Congratulations, you have installed Microsoft Visual Studio Code on Linux Mint 20.
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 autoremove code --purge
Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: code* 0 to upgrade, 0 to newly install, 1 to remove and 0 not to upgrade. After this operation, 303 MB disk space will be freed. Do you want to continue? [Y/n]
Type “Y”, then press the “ENTER KEY” to proceed with the removal of Visual Studio.
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 Linux Mint 20 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.