Visual Studio Code is a free cross-platform source code editor developed by Microsoft. It has built-in debugging support, embedded Git control, syntax highlighting, code completion, code refactoring, and snippets.
The functionality of Visual Studio Code can be extended using extensions.
This tutorial guides you on how to install Visual Studio Code editor on Ubuntu 18.04 / Linux Mint 19 & Debian 9 from the Microsoft’s VS Code repository.
Configure Visual Studio Code Repository
Microsoft provides the official repository for easy installation of Visual Studio Code for Ubuntu and Debian operating systems. So, you can set up the Microsoft repository on your system receive the VS Code package.
As a first task, update the repository index using the apt
command
sudo apt update
Install the HTTPS support for apt and other packages.
sudo apt install -y curl apt-transport-https
Download and import the Microsoft signing GPG key using the curl command.
curl -sSL https://packages.microsoft.com/keys/microsoft.asc -o microsoft.asc sudo apt-key add microsoft.asc
Now, add the Visual Studio Code repository to your system.
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
Once you have added the repository to the system, do not forget to update the repository index.
sudo apt update
Use the apt command to install Visual Studio Code.
sudo apt install -y code
Start Visual Studio Code
Once the VS Code is installed on your system, you can launch it either from the command line or by clicking on the VS Code icon in graphical mode.
$ code
OR
Ubuntu 18:04: Activities >> Search for Visual Studio Code
Linux Mint 19: Menu >> Programming >> Visual Studio Code
Debian 9: Activities >> Search for Visual Studio Code
Visual Studio Code running on Ubuntu 18.04:
Visual Studio Code running on Linux Mint 19:
Visual Studio Code running on Debian 9:
Set VS Code as the default editor
If you have multiple source code editors and want to set the Visual Studio Code as the default editor for your project, you need run the below command to set Visual Studio Code as the default editor.
sudo update-alternatives --set editor /usr/bin/code
Update Visual Studio Code
Microsoft releases the update for Visual Studio Code monthly. You can update the version of Visual Studio Code similar to other packages, using the apt command.
sudo apt update sudo apt upgrade code
Conclusion
You have successfully installed Visual Studio Code on your Ubuntu 18.04 / Linux Mint 19 & Debian 9. You can now install extensions and configure VS Code according to your preferences. Also, learn about the User Interface of the VS Code.
That’s All.