How to Install Visual Studio Code on Ubuntu 20.04

Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop.

It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages such as C++, C#, Java, Python, PHP, Go and runtimes (such as .NET and Unity).

Visual Studio Code supports macOS, Linux, and Windows – so you can hit the ground running, no matter the platform.

Image Credit: visualstudio.com

Since its release in 2015, Microsoft’s Visual Studio Code has quickly established itself as the most popular code editor out there.

In the last two years, evidence from Google’s search trends would indicate that interest in VS Code (in Blue, below) has overtaken that of all other major text editors.

Though every editor has its unique strengths, VS Code is arguably the most popular because it’s more customisable, more regularly updated, and boasts a more diverse ecosystem of extensions than its competitors.

Together, these features allow VS Code to provide an extremely fast workflow for developers.

Visual Studio Code features a lightning fast source code editor, perfect for day-to-day use. With support for hundreds of languages, VS Code helps you be instantly productive with syntax highlighting, bracket-matching, auto-indentation, box-selection, snippets, and more.

Intuitive keyboard shortcuts, easy customization and community-contributed keyboard shortcut mappings let you navigate your code with ease.

For serious coding, you’ll often benefit from tools with more code understanding than just blocks of text.

Visual Studio Code includes built-in support for IntelliSense code completion, rich semantic code understanding and navigation, and code refactoring.

And when the coding gets tough, the tough get debugging. Debugging is often the one feature that developers miss most in a leaner coding experience, so we made it happen.

Visual Studio Code includes an interactive debugger, so you can step through source code, inspect variables, view call stacks, and execute commands in the console.

VS Code also integrates with build and scripting tools to perform common tasks making everyday workflows faster. VS Code has support for Git so you can work with source control without leaving the editor including viewing pending changes diffs.

Key Features include:

  • Syntax highlighting
  • Autocomplete with IntelliSense based on variable types
  • Function definitions
  • Imported modules
  • The ability to debug code from the
  • Custom hotkeys
  • Templates and boilerplates
  • Integrating with GitHub
  • Intellisense, which provides smart completions based on variable types
  • Customizable themes

This article explains two methods of installing Visual Studio Code on Ubuntu 20.04.

Visual Studio Code can be installed as a snap package via the Snapcraft store or as a .deb package from the Microsoft repositories.

Choose the installation method that is most appropriate for your environment.

Method 1: Installing Visual Studio Code as a Snap Package

The Visual Studio Code snap package is distributed and maintained by Microsoft.

A snap package is a type of universal Linux package that you can enjoy irrespective of the distro. Its an self-contained software packages that include the binary all dependencies needed to run the application.

All you need is the snap service pre-configured, In the case of Ubuntu 20.04, it comes with snap pre-installed.

If snapd package is not already installed then you can install it by running following command.

$ sudo apt install snapd

Note: Snap packages can be installed from either the command-line or via the Ubuntu Software application.

This is actually the Snap version of the Visual Studio Code. It can be used on any Linux distribution that has Snap support.

Open your terminal (Ctrl+Alt+T) and type the following command to install the VS Code package.

$ sudo snap install --classic code

That’s It. Now you can open the Visual Studio Code application with the help of Activities search bar.

Note: Whenever a new version is released, the VS Code snap package will be automatically updated in the background.

If you are not comfortable with the command line, open Ubuntu Software, search for “Visual Studio Code” and install the application.

Image Credit: linuxize.com

Method 2: Installing Visual Studio Code via apt

Step #1

Installing Visual Studio Code using apt is a relatively easy process and takes only a few minutes to complete.

Open a terminal (CTRL+ALT+T) and execute the below commands to update packages.

$ sudo apt update && sudo apt upgrade

Note: The user must have sudo privileges to run all these commands.

Step #2

Install the prerequisites.

$ sudo apt install software-properties-common apt-transport-https wget

Step #3

Import the Microsoft GPG key using wget command.

$ wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -

Step #4

Now type the following command to enable the Visual Studio Code repository.

$ sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"

Step #5

Once the VS Code apt repository is enabled , execute the following command to install the Visual Studio Code package.

$ sudo apt install code

When a new version of Visual Studio Code is released you can update the package by executing the following commands.

$ sudo apt update && sudo apt upgrade

Or if you are not comfortable with commands then you can always update the package graphically. You can do so through your desktop standard Software Update tool.

Starting Visual Studio Code

In the Activities search bar type “Visual Studio Code” and click on the icon to launch the application.

Activity Search Bar

Visual Studio Code Welcome Screen:

Image Credit: visualstudio.com

How to Uninstall Visual Studio Code from Ubuntu 20.04

For some reason, If you want to uninstall Visual Studio Code, then here are some methods you can follow.

If you installed via Snap:

$ sudo snap remove code

If you installed via apt:

$ sudo apt purge code

Or If you installed via Ubuntu Software, open Ubuntu Software, look for the app in the installed category, and click on remove.

Conclusion

I hope that now you have a good understanding of How to Install Visual Studio Code on Ubuntu 20.04 LTS Focal Fossa.

If anyone does have any questions about what we covered in this guide then feel free to ask in the comment section below and I will do my best to answer those.

Sources:

If you like our content, please consider buying us a coffee.

Buy Me A Coffee

We are thankful for your never ending support.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.