Install Visual studio code on Ubuntu

In this tutorial, we will be installing visual studio code IDE. Visual Studio Code is a powerful lightweight code editor that is available for all major platforms like Windows, macOS, and Linux. In this tutorial, we will be using Ubuntu 16.04 LTS / 18.04 LTS and other Linux distros to install the visual basic code editor. Visual studio code comes with built-in support for the Javascript, Nodejs, etc and extensions available for other languages like PHP, Java, Python, etc.

Let's get started

Method 1. Install visual studio code from snap

In this section, we will install the visual studio code from the snap package. It is officially available in Snap Package in the snap store.
Enter the following command to install

sudo snap install --classic code # or code-insiders

Once you installed it from the snap package. Snap package daemon will automatically update the install VS code editor.

Method 2. Install using .deb file

In this section, we will install the visual studio code from .deb. Open the following URL and download the latest vs code editor.

https://code.visualstudio.com/Download

Once you download navigate to your download directory and enter the following command

sudo dpkg -i <vs-code-editor-download-file>.deb

The above command will install the vs code editor. Now enter the following command to install its dependency.

sudo apt install -f

Method 3. Install using official Linux repositories

In this section, we can also install the visual studio IDE using Linux repositories all you need to do is add the repo and install. To do so enter the following command to add.

curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /usr/share/keyrings/
sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'

Now update your repository cache and install the package using below command

sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install code # or code-insiders