How To

Install VS Code on Ubuntu 20.04: Snap Package and Apt Guide

Visual Studio Code (VS Code) is an open-source code editor developed by Microsoft. It is one of the most popular editors among developers and works for almost every language – Python, JavaScript, Go, C++, and many more.

VS Code comes with a solid set of built-in tools:

  • Syntax highlighting and intelligent code completion
  • Integrated terminal and built-in Git support
  • Debugging tools for multiple languages
  • Extensions marketplace with thousands of add-ons
  • Code refactoring, snippets, and multi-cursor editing

VS Code is cross-platform and runs on Windows, macOS, and Linux. This guide covers two ways to install VS Code on Ubuntu 20.04. The snap method is simpler and updates automatically. The apt method gives you more control over updates and fits better with a package-managed system. Pick the one that suits your workflow.

Method 1: Install VS Code as a Snap Package

The snap method is the fastest way to get VS Code up and running. Snap packages are self-contained — they bundle all the dependencies the app needs, so you do not have to manage them separately.

The trade-off is that snap packages tend to have a larger disk footprint and a slightly slower startup time than a standard .deb package.

Install the VS Code snap with:

bashsudo snap install --classic code

The --classic flag gives VS Code full access to the system. VS Code needs this to work properly with your project files and local tools.

That is it. VS Code is installed and will update itself in the background whenever a new version comes out.

If you prefer not to use the terminal, open Ubuntu Software, search for “Visual Studio Code”, and install it from there using the graphical interface.

Method 2: Install VS Code on Ubuntu with Apt

This method adds the official Microsoft apt repository to your system. It gives you more control — you decide when to update, and the package is managed the same way as any other software installed through apt.

First, install the required dependencies:

bashsudo apt updatesudo apt install software-properties-common apt-transport-https wget

Add the Microsoft GPG key so your system can verify the packages come from a trusted source:

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

Add the VS Code repository:

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

Install VS Code:

bashsudo apt install code

To update VS Code later, run the standard apt update and upgrade commands:

bashsudo apt updatesudo apt upgrade

Launch Visual Studio Code

Open the Activities search bar, type “Visual Studio Code”, and click the icon to open it.

You can also launch it from the terminal:

bashcode

To open a specific project folder, pass the path directly:

bashcode /path/to/your/project

Or use code . from inside a directory to open the current folder in VS Code.

The first time you open VS Code, the welcome screen appears. From there you can:

  • Install extensions from the marketplace
  • Open or clone a Git repository
  • Customize your theme, keyboard shortcuts, and settings

VS Code remembers your last workspace, so it picks up right where you left off each time you open it.

VS Code is now installed and ready on your Ubuntu machine. It works well straight out of the box and becomes even more powerful as you add extensions. Whether you are writing Python scripts, working with Docker, or building a web app, VS Code adapts to your workflow. Got questions? Leave a comment below.

Cyber Defence

Recent Posts

Install MySQL on Ubuntu 20.04: Setup, Security, and Root Access

MySQL is the most popular open-source relational database management system. It is fast, reliable, and a…

2 hours ago

Install Git on Ubuntu 20.04: Apt, Source, and Configuration

Git is the most widely used version control system in the world. It was created by…

2 hours ago

Install Go on Ubuntu 20.04: Download, Setup, and First Program

Go (also called Golang) is an open-source programming language built by Google. It is designed to…

2 hours ago

Install Nginx on Ubuntu 20.04: Setup, Firewall, and Config Guide

Nginx (pronounced "engine x") is an open-source, high-performance web server and reverse proxy. It is used…

2 hours ago

Install Apache on Ubuntu 20.04: Setup and Virtual Host Guide

Apache is one of the most widely used open-source web servers in the world. It is…

1 day ago

Add Swap Space on Ubuntu 20.04: Create, Enable, and Tune

Swap space is an area on disk that Linux uses when it runs out of physical…

1 day ago