Install Visual studio code on Ubuntu linux

Visual studio code

courtesy

If you’re trying to work on .NET outside of Windows, you probably be missing Visual studio. A completesub-alternative is VS code.

Now, we’re going to setup it on Ubuntu linux

The contents of the extracted folder will look something like:

visual studio code extracted folder

code is the executable file we’re interested in:

visual studio code is an executable file

  • Double click code

For the sake of organisation, I have all the downloaded setups in a separate directory called Programs. Yes, inspired by Windows

Running code everytime from it’s folder is too much work. To minimize it, we can create a symbolic link using the command sudo ln -s /path/to/vscode/Code /usr/local/bin/code

In my case, I replaced /path/to/vscode/Code with ~/Programs/VSCode-linux-x64/Code so the final syntax is

sudo ln -s ~/Programs/VSCode-linux-x64/Code /usr/local/bin/code

In case of already created symbolic link, an error will be shown:

linux error when symbolic link is already created

From next time, we can just open a terminal with Ctrl Alt T and type code

open visual studio code on terminal

After installation, make sure to always run the dnvm and dnu commands by adding to .bash_profile using the below commands:

echo 'source dnvm.sh' >> ~/.bash_profile
echo 'export MONO_MANAGED_WATCHER=disabled' >> ~/.bash_profile

Verify that commands are actually added:

  • Go to Home in Files explorer

Home in file explorer

  • Unhide hidden files using Ctrl+H
  • Locate the .bash_profile file
  • Open it with gedit or your favourite editor

.bash_profile in gedit

  • Locate the below lines:

    source dnvm.sh
    export MONO_MANAGED_WATCHER=disabled

Alternatively, use cat or less commands:

using cat command for .bash_profile file

And VS code is ready to use:

visual studio code welcome page

Photos