# Best way to install vscode in ubuntu The best way to install VSCode on Ubuntu is via the official Microsoft repository. This ensures you get the latest updates and security patches. Follow these steps: ### 1. **Install dependencies** ```bash sudo apt update sudo apt install wget gpg -y ``` ### 2. **Import the Microsoft GPG key** ```bash wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /usr/share/keyrings/packages.microsoft.gpg > /dev/null ``` ### 3. **Add the VSCode repository** ```bash 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 ``` ### 4. **Update and install VSCode** ```bash sudo apt update sudo apt install code -y ``` ### Alternative Installation Methods: 1. **Using Snap** ```bash sudo snap install code --classic ``` *Pros:* Easy to install, auto-updates. *Cons:* Slower startup time and larger disk usage. 2. **Using Flatpak** (if Flatpak is installed) ```bash flatpak install flathub com.visualstudio.code ``` *Pros:* Works well across different Linux distributions. *Cons:* Slightly slower than the `.deb` version due to sandboxing. The `.deb` package from the official repository is the recommended method for optimal performance.