How to install Visual Studio Code on Ubuntu

Visual studio has been one of the leading code editor. I mostly use sublime text for its simplicity but many a times, Visual studio code feel more comfortable considering many add on features like git integration, debugging tools, autocomplete and not to forget inbuilt terminal.

Method#1 Install Visual Studio Code using .deb package

Step#1 Download Visual Studio code .deb/ *.rem package from https://code.visualstudio.com

Step#2 Install downloaded package using following command

sudo dpkg -i DEB_PACKAGE

Alternatively, you can simply double click on *.deb package. It will open software center page as below. Simply click on install. One you click on install, it will prompt you for password. Install the password and hit enter / click Authenticate.

Method#2 Install Visual Studio code from Ubuntu Software

Got to Ubuntu Software. ( by searching Ubuntu software in search box). Type Visual Studio in the Ubuntu Software sear box and you will see the Visual Studio Code, click on “install” button and you are good to go.

One you click on install, it will prompt you for password. Install the password and hit enter / click Authenticate.

Method#3 Install Visual Studio Code using snap

This is easiest method. Simple run following command and visual studio code will be installed immediately.

$ sudo snap install --classic vscode
vscode 1.29.1-1542309157 from Snapcrafters installed

If you want to know more about what is snap and how to use it ? please read this article

How to remove Visual Studio from Ubuntu

Method#1  Using Ubuntu Software

Got to Ubuntu Software. ( by searching Ubuntu software in search box). Type Visual Studio in the Ubuntu Software sear box and you will see the Visual Studio Code, click on “remove” button and you are good to go.

One you click on remove, it will prompt you for password. Install the password and hit enter / click Authenticate.

Method#2  Using Command Prompt

Just to check if Visual Studio Code is installed, run following command.

$ sudo apt list code
Listing... Done
code/stable,now 1.29.1-1542309157 amd64 [installed]

As you can see, name of the package is code. Now run following command

$ sudo apt-get remove code
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
code
0 upgraded, 0 newly installed, 1 to remove and 197 not upgraded.
After this operation, 193 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 323562 files and directories currently installed.)
Removing code (1.29.1-1542309157) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...

Method#3  Using snap

Use this only if you have installed If you have installed Visual Studio code using snap then use following command

$ sudo snap remove  vscode
vscode removed

Note: You can use snap command to uninstall if you have installed using snap or installed from Ubuntu software center, however, if you have installed using .deb file, snap will not be able to remove the package

Upgrading Visual Studio code
Following command will upgrade all packages install on Ubuntu to their latest version

sudo apt update && sudo apt upgrade