Linux

Installing Microsoft Visual Studio Code on Ubuntu and Other Linux

Microsoft’s open-source code editor, Visual Studio Code, is exceptional. Discover how to install VS Code on Ubuntu and other Linux distributions.

Microsoft made an unexpected move by releasing Visual Studio Code for all major desktop platforms, including Linux. Shortly after its release, Visual Studio Code quickly became one of the top open-source code editors. Its features are beneficial not only to web developers but to programmers of all types.

I won’t go into the details of Visual Studio Code’s features here, as you’re likely already familiar with them. Instead, I’ll guide you on how to install Visual Studio Code on Ubuntu and other Linux distributions.

Method 1: Install Visual Studio Code on Linux Using Snap

Visual Studio Code is available as a Snap package. If you’re using Ubuntu, you can easily find it in the Software Center and install it with just a few clicks.

Snap packaging allows you to install Visual Studio Code on any Linux distribution that supports Snap packages. Ensure that Snap support is enabled on your Linux distribution if it isn’t already.

To install Visual Studio Code via Snap, run the following command:

sudo snap install code –classic

The installation time will vary depending on your internet connection speed.

Removing VS Code Snap

To remove VS Code installed via Snap, you can do so through the Software Center or the terminal.

Using the Software Center: Open the Software Center, navigate to the “Installed” apps section, find VS Code, and click “Remove” to uninstall it.

Using the Terminal: You can also remove VS Code by running the following command:

sudo snap remove code

Method 2: Using the .deb/.rpm Packages

Microsoft offers .deb and .rpm packages for installing Visual Studio Code on Linux. To get these packages:

Visit the Visual Studio Code download page.
Choose the appropriate package for your Linux distribution—.deb for Debian-based distributions (like Ubuntu) or .rpm for Red Hat-based distributions (like Fedora).
Download the file, then follow the instructions specific to your distribution for installation.
There are also options available for 32-bit systems. If you’re unsure whether your Ubuntu is 32-bit or 64-bit, you can refer to our guide to determine your system’s architecture and download the appropriate files.

Once downloaded, you can install the .deb file on Ubuntu (or other Ubuntu-based distributions) using the following methods:

There are also options for 32-bit systems. If you’re not sure whether your Ubuntu is 32-bit or 64-bit, you can check our guide to determine your system’s architecture and download the correct files.

After downloading, you can install the .deb file on Ubuntu (or other Ubuntu-based distributions) using the following methods:

Via Software Center: Right-click the downloaded .deb file and select “Open with Software Center.” If this option isn’t available, choose “Open with other applications” and then select “Software Install.”

Via Terminal: Alternatively, you can install the .deb file by opening a terminal, navigating to the file’s location, and running:

sudo dpkg -i filename.deb

Replace filename.deb with the actual name of the file you downloaded.
Now, press the “Install” button in the Software Center to install it.
To remove the VS Code app installed from a .deb or .rpm file, you can follow the same steps as removing any other application from the Software Center.

Simply open the Ubuntu Software Center, search for the application name, and click on Uninstall to remove it.

Alternatively, if the application does not appear in the Ubuntu Software Center for some reason, you can use Synaptic Package Manager to remove it.

Method 3: Using Flatpak

If you dislike using snap packages, you can always use Flatpak.

I recommend referring to our guide on using Flatpak on Linux if you’re new to it.

Alternatively, if your software store supports Flatpak, you can simply search for Visual Studio Code and install it directly.

Once you have added Flatpak support, you can install the app using the following command:

flatpak install flathub com.visualstudio.code

To remove the VS Code Flatpak version, you can use either the Flatpak-supported Software Center or the terminal, similar to removing snap packages.

Open the Software Center, browse for VS Code in the list of installed apps, and click on Uninstall to remove it.

Or, open a terminal and enter:

flatpak uninstall com.visualstudio.code

If you prefer not to keep unused runtimes and packages that are no longer required, you can run:

flatpak uninstall –unused

Bonus Tip: Removing VS Code data

VS Code keeps some data on the disk. If you reinstall it, you’ll find that your extensions and some other settings are still present.

If you want to remove all traces of VS Code from your system, you should also delete these application-related files.

Typically, it creates a .vscode folder in your home directory and a folder named Code in the .config directory within your home directory.

Deleting these folders should remove all traces of VS Code.

Conclusion

As a last resort, you can always build it from the source code. The source code for VS Code is available on its GitHub page.
Installing Visual Studio Code on Ubuntu is quite straightforward with the available Snap, Flatpak, or .deb/.rpm packages.


Thank you for reading our article..

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button