How to Install VSCode in Linux?

LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now

VSCode is a powerful and versatile text editor for developers in terms of software development, app development, etc. While it’s primarily known for its Windows and macOS versions, it’s also fully compatible with Linux distributions. This guide aims to walk you through the process of installing VSCode on your Linux system.

There are three approaches to installing VSCode in Linux:

  1. Using a universal package manager.
  2. Using Distribution’s Package Manager
  3. Using VSCode Installer

Let’s explore the processes for installing VSCode in Linux.

1. Install VSCode Using Snap

Snap is a universal package manager for all Linux distributions. To install VSCode in Linux using Snap, simply run the following command in the terminal:

sudo snap install code --classic

EXPLANATION
The sudo command grants the installation process administrative privileges. The rest of the command instructs the system to download and install the specified package referred to by the VSCode code. Here, the --classic flag is used to install the package in classic confinement mode which grants the snap additional privileges like accessing files and services outside the confined environment.

Installing VSCode in Linux using snap.After installing the VSCode, you can check for the VSCode version using the following command:

code --version

Checking the version of the installed VSCode in your Linux system.The command shows that the VSCode version is 1.87.2. It represents the second release of VSCode installed within the 87th minor version under the first major version of VSCode.

Note: If you don’t have Snap installed in your system (any distribution of Linux), check this snap installation guide as you need.

2. Install VSCode Using Distribution’s Package Manager

Visual Studio Code (VSCode) can also be installed on Linux using dedicated package managers designed for specific distributions such as apt for Debian-based distros, yum for Red Hat-based distros, and Pacman for Arch Linux-based distros. This section demonstrates the installation process using different package managers for specific distros.

In Ubuntu/Debian-based

To install Visual Code (VSCode) Debian-based distros like Debian and Ubuntu, you must use the package manager apt or apt-get.

Check the following steps to install VSCode in Ubuntu-based Linux distro:

  1. Before installing, ensure your package lists are up to date by running the following command:

    sudo apt update
  2. Download the .deb package (64-bit) from the Visual Studio Code download page.

    Downloading the .deb package of VSCode from the VSCode official download page.

  3. Now, run the following command to install the deb package
    sudo apt install <filepath>.deb

    Replace <filepath>.deb with the complete path of the downloaded deb package with .deb extension as below:

    sudo apt install $HOME/Downloads/code_1.87.2-1709912201_amd64.deb

    Installing the .deb file of VSCode using aptThe command installs the new packages of code (VSCode) successfully.

In Red Hat-based

To install Visual Studio Code (VSCode) on a Red Hat-based Linux distribution like RHEL, Fedora, CentOS, etc you can follow these steps:

  1. First, download the rpm package of VSCode from the Visual Studio Code download page.
  2. After the download is complete, install VSCode using the following command
    sudo yum install <filepath>.rpm

In Arch Linux-Based

The easiest way to install VSCode in Arch Linux-based distros like Manjaro, and Arch Linux itself is through the official repositories.

To do this, run the following command:

sudo pacman -S install code

However, you can also install VSCode from the Arch User Repository (AUR). If you prefer installing from the AUR, you can use an AUR helper like yay. First, install “yay”:

sudo pacman -S yay

Then, install VSCode using yay by running the following command:

yay -S visual-studio-code-bin

3. Install Using VSCode Installer

VSCode installer is a program that installs VSCode on a computer system. To install VSCode using the installer, follow the steps below:

  1. Open App Center in Ubuntu and search for “Code”. Then click on the application named code.

    To install from the VSCode installer, search "code" in the "App Center".

  2. After that, click on the Install button.

    Click on the "Install" button to install VSCode.

  3. Later on, authenticate yourself by providing the user password, and then click on the Authenticate button.

    Enter the user passowrd and click on Authenticate" button to ensure authentication.

  4. In a short period, VSCode will be installed and an open button will appear. click on it and you are all set to start using VSCode.Finally, click on "Open" to start the VSCode.This is how you can install VSCode using the VSCode installer GUI easily.

How to Start VSCode on Ubuntu?

To start VSCode on Ubuntu, click on the Show Application, and in the search bar, type “Visual Studio Code”. The icon of Visual Studio Code will appear. After that, click on its icon to launch the VSCode.

To start VSCode, search "visual Studio Code" in the search bar, and click on the application.Alternatively, you can simply run the following code in the terminal to start VSCode on Ubuntu:

code

How to Uninstall VScode from Linux?

You can uninstall VSCode in three approaches such as using Snap, using distro-based package manager, and using GUI.

Using Snap

If you ever need to uninstall Visual Studio Code (VSCode), you can use Snap as the following command:

sudo snap remove code

Using Package Manager

You can also uninstall VSCode using a package manager like apt or yum. For example, to uninstall VSCode in Ubuntu, run the following command:

sudo apt remove code

Using GUI

Uninstalling VSCode using Graphical User Interface (GUI)  is a straightforward process that can be accomplished from the application center provided by your Linux distro. For example, to uninstall VSCode from GUI in Ubuntu, follow the steps below:

  1. Open App Center.

  2. Navigate to Manage > Installed and Updated > Code.

  3. Next to the “Open” button, click on the three-dot (…) icon. This will reveal an option to uninstall VSCode. Simply click on it to proceed with the uninstallation.

Conclusion

In conclusion, there are various methods to install VSCode on Linux, including using Snap, a package manager, or the VSCode installer. You have the flexibility to select any method and simply follow the provided instructions at your convenience. I hope this article simplifies the process of installing VSCode on your Linux system.

People Also Ask

How to install VSCode in Ubuntu?

To install VSCode in Ubuntu, first download the .deb package from the Visual Studio Code download page. After that, run the command sudo apt install <filepath>.deb in the Ubuntu terminal. Don’t forget to update the package lists using the command sudo apt update.

What is Visual Studio Code?

Visual Studio Code (VSCode) is a freely available, open-source text editor and integrated development environment (IDE) designed for use on Windows, Linux, and macOS platforms. It provides a wide range of features including debugging capabilities, syntax highlighting, code refactoring tools, code snippets, automatic code completion, built-in Git version control, and more.

How to launch VSCode in Ubuntu after installing it?

To launch Visual Studio Code after installing it on your Ubuntu system, click on the “Show Applications” button on the Ubuntu and type “Visual Studio Code” into the search bar. Visual Studio Code should then appear in the search results. Click on its icon to initiate the application.

How can I set Visual Studio code using the apt package manager?

To set up Visual Studio Code (VSCode) using the apt package manager on Ubuntu, you need to add the Microsoft Key repository to your system’s package list. You can set VSCode using the apt package manager as below:

  1. Import the Microsoft GPG key using the following command:
    wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
    sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
  2. Add the VSCode repository by running the code below:

    sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'

After that, install VSCode and lastly update your distro.

Related Articles


<< Go Back to VSCode in Linux | Linux Text Editors | Learn Linux Basics

Rate this post
Auhona Islam

Auhona Islam is a dedicated professional with a background in Electronics and Communication Engineering (ECE) from Khulna University of Engineering & Technology. Graduating in 2023, Auhona is currently excelling in her role as a Linux content developer executive at SOFTEKO to provide a more straightforward route for Linux users. She aims to generate compelling materials for Linux users with her knowledge and skills. She holds her enthusiasm in the realm of Machine Learning (ML), Deep Learning (DL), and Artificial Intelligence (AI). Apart from these, she has a passion for playing instruments and singing. Read Full Bio

Leave a Comment