How To Uninstall and Install Visual Studio Code in Ubuntu 22.04
As we all know, Ubuntu just launched Beta version of Ubuntu 22.04 version with a lot of new features. So is installing new software like VSCode any different from old versions? This tutorial will show you several ways to install Visual Studio Code in Ubuntu 22.04.
What is VSCode?
VSCode is a lightweight code editor, cross-platform, available on Windows, MacOS and Linux. It has built-in support for JavaScript, TypeScript, and Node.js, as well as any programming languages such as C++, Java, Python, … VSCode is a powerful editor because it has many extensions you can install to improve your productivity, it is a must-have tool every developer needs.
Prerequisites to install VSCode Ubuntu
- Operating system: Ubuntu 22.04.
- Account: Has
sudo
permissions. - If you want to install VSCode by using Snap Store, you must install Snap firstly.
Install Visual Studio Code in Ubuntu 22.04
VSCode is one of the most popular global code editors. Because of that, it has been provided a lot of ways so that anyone can install it easily on their Linux machine. This tutorial will give you three ways to achieve that. Choose the technique of installation that is best for your situation.
Install Visual Studio Code on Ubuntu using Software Center
If you’re using Ubuntu, Ubuntu Center Software should be your first choice before you want to install any applications. Following these steps to get this code editor.
Step 1: Open the Ubuntu Center Software
Step 2: Search for Code Editor
Because the Ubuntu Software Center has a large number of packages, we must type Visual Studio Code
into the search box to get the results.
Step 3: Start the installation
After all the search results appear, click on the first row, and then press the Install button to start the installation.
Using APT to install Visual Studio Code in Ubuntu
This editor is developed by Microsoft Teams. They allow us to install VSCode Ubuntu from the offical Microsoft APT Repositories. Following these commands to install it:
Step 1: Update the Ubuntu packages index
Before we begin installing any applications, we must first update the packages index and install the dependencies need for that app by running the following commands:
sudo apt update
sudo apt install software-properties-common apt-transport-https wget
Step 2: Add VSCode repository to your Ubuntu
We’ll use the wget command to import the specified Microsoft GPG key into the terminal in this step:
wget –q https://packages.microsoft.com/key/microsoft.asc -O- | sudo apt-key add -
After that, we will need to enable VSCode repository:
sudo add-apt-repository "deb [ach=amd64] https://packages.microsoft.com/repos/vscode stable main"
Step 3: Install VSCode package
Whenever a repository is added to the system. The final step is to run the installation command for the VSCode Ubuntu, which is mentioned below:
sudo apt install code
Install Visual Studio Code in Ubuntu using Snap Store
Snap is a collection of apps and their dependencies that run on a variety of Linux distributions without needing to be modified. Therefore, you can easily install VSCode Ubuntu 22.04 by using Snap.
Executing commands through the terminal provides us with a quick way to do anything, including using Snap’s utilities. So, I think you should install this code editor by using command after open terminal:
sudo snap install --classic code
After the process installation is finished, It means the VSCode is installed successfully on your Ubuntu machine.
Launch VSCode
After installing VSCode Ubuntu, you can now open this application by searching VSCode
in Activities
and click its icon to launch. When you open it, a window like this appear:
Uninstall VSCode on Ubuntu 22.04
Same as the installation process, the uninstall process is also easy. To uninstall VSCode on your Linux machine, you can run this command to uninstall the program:
sudo apt purge code
Then, we will need to run this command remove all shortcuts, menu items, …
sudo apt autoremove
Conclusion
In this tutorial, I introduced ways to install Visual Code Studio in Ubuntu 22.04, and I also help to uninstall VSCode too. Keep in mind that, this tutorial is also available for older Ubuntu versions. Please do not hesitate to contact me if you have any questions.