How to Install Visual Studio Code (VS Code) on Ubuntu Linux
Visual Studio Code (VS Code) is a powerful and lightweight source code editor developed by Microsoft. It supports a wide range of programming languages and offers built-in Git support, extensions, debugging tools, and more.
In this tutorial, you’ll learn how to install VS Code on Ubuntu Linux using the official Microsoft repository. This method ensures you always get the latest version through the apt package manager.
📥 Step 1: Update Your Package List
sudo apt update
🔑 Step 2: Install Required Dependencies
sudo apt install software-properties-common apt-transport-https wget gpg
🔐 Step 3: Import Microsoft GPG Key
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/
rm packages.microsoft.gpg
📦 Step 4: Add the VS Code Repository (for Ubuntu)
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 List Again
sudo apt update
✅ Step 6: Install Visual Studio Code
sudo apt install code
🚀 Step 7: Launch VS Code
You can now launch Visual Studio Code from the terminal:
code
Or search for “Visual Studio Code” in your Ubuntu application menu.
💡 Bonus: Install Popular Extensions
Here’s how to install the Python extension from the terminal:
code --install-extension ms-python.python
Explore thousands of extensions using the Extensions panel inside VS Code.
🧪 Practice Tips
- Install useful extensions:
code --install-extension <extension-id> - Customize settings: press
Ctrl + , - Open the Command Palette: press
Ctrl + Shift + P
