How to Install Visual Studio Code on Ubuntu: A Step-by-Step Guide
Are you ready to supercharge your coding experience on Ubuntu? Visual Studio Code (VS Code) is a powerful, lightweight source code editor developed by Microsoft that supports hundreds of programming languages and extensions. Whether you’re a developer, student, or hobbyist, having VS Code on your Ubuntu machine is essential.
In this post, I’m going to walk you through how to install Visual Studio Code in Ubuntu quickly and painlessly—with clear steps and tips along the way.
Why Choose Visual Studio Code?
Before we dive into installation, here’s why VS Code is so popular:
- Free and open-source
- Supports debugging out-of-the-box
- Integrated Git control
- Extensive extension marketplace
- Customizable with themes and settings
- Cross-platform support
Sounds good? Great! Let’s get it set up.
How to Install Visual Studio Code in Ubuntu
You have multiple ways to install VS Code: via the official repository using APT (recommended), via Snap packages, or by manually downloading the DEB file. We’ll focus on the recommended repository method for stability and easy updating.
Step 1: Update Your System Packages
Open your terminal with Ctrl + Alt + T and update your package lists:
sudo apt update
sudo apt upgrade -y
This ensures your system is ready for new installs.
Step 2: Install Required Dependencies
To add Microsoft's repository, you need wget
and gpg
tools. Install them if you don’t have them already:
sudo apt install wget gpg -y
Step 3: Import Microsoft GPG Key
Add the Microsoft GPG key to verify package authenticity:
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /usr/share/keyrings/
Step 4: Add VS Code Repository
Now add the Visual Studio Code repository by creating a new source list file:
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" | sudo tee /etc/apt/sources.list.d/vscode.list
Step 5: Update Package Lists Again
Refresh package lists so the new repository is included:
sudo apt update
Step 6: Install Visual Studio Code
Finally, install VS Code using apt:
sudo apt install code
Once installed, you can start VS Code from the terminal simply by typing:
code
Or find it in your applications menu as "Visual Studio Code."
Bonus: Quick Setup Tips After Installation
Install Popular Extensions via CLI
VS Code has an awesome extensions marketplace. You can install extensions straight from the terminal. For example:
code --install-extension ms-python.python # Python support
code --install-extension eamodio.gitlens # GitLens for git superpowers
code --install-extension ms-vscode.cpptools # C/C++ tools
Open a Project Folder Quickly
Navigate to your project folder in terminal:
cd ~/projects/my-app/
code .
The .
tells VS Code to open the current directory—super handy!
Alternative: Install VS Code Using Snap (Quick But Less Customizable)
If you prefer snaps, run:
sudo snap install --classic code
However, some users report minor issues with snap confinement affecting certain extensions—so I recommend the APT method if possible.
Conclusion
Installing Visual Studio Code on Ubuntu is straightforward once you know where to start. With this setup, you’re ready for web development, Python scripting, C++ projects—or whatever else sparks your creativity.
Have questions or want me to cover customization tips next? Leave a comment below!
Happy coding on Ubuntu with VS Code! 🚀
This guide was tested on Ubuntu 20.04/22.04 LTS.