Uncategorized

6.2 How to Install Visual Studio Code on Ubuntu Linux

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

Leave a Reply

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