Visual Studio Code (VS Code) remains the most popular code editor for Linux, blending lightweight performance with powerful IDE-like capabilities. Below are all the current methods to install it, including their pros, cons, and full removal instructions.
- Installing via the Official Microsoft Repository (APT)
- Repository Access Issues
- Installing via Snap
- Installing via Flatpak
- How to Completely Uninstall Visual Studio Code
- Visual Studio Code Keyboard Shortcuts
- Working with Comments
- Working with Lines
- Selection and Editing
- Working with Tabs
- Search and Navigation
- Terminal
- Frequently Asked Questions(FAQ)
- Why can’t VS Code see Python, Node.js, or Git?
- Can I install the Stable and Insiders versions simultaneously?
- How can I check if VS Code is installed and which version I have?
- Conclusion
Installing via the Official Microsoft Repository (APT)
This is the recommended method for professional developers. It installs a native .deb package that is fully integrated with your system and lacks the restrictions of a “sandbox.”
Installation Steps:
1. Update packages and install dependencies:
sudo apt update && sudo apt install wget gpg apt-transport-https -y
2. Add the GPG Key (to verify package authenticity):
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
3. Enable the repository:
echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" | sudo tee /etc/apt/sources.list.d/vscode.list > /dev/null
4. Install the editor:
sudo apt update
sudo apt install code
Repository Access Issues
If you encounter errors like “Connection refused,” “Timed out,” or “403” while running apt update or wget, it means Microsoft’s servers are inaccessible from your network or country due to geo-restrictions. In this case, use Amnezia VPN or Proton VPN to restore access. For a detailed guide on choosing and configuring a reliable service, check out this Amnezia VPN review.
Installing via Snap
Snap packages come pre-installed on Ubuntu. They are convenient because the app updates automatically in the background. However, due to “sandboxing,” the editor may sometimes fail to detect system compilers without manual configuration.
Installation Steps:
sudo snap install code --classic
The
--classicflag is required so that VS Code can access system files outside its sandbox.
Installing via Flatpak
A popular alternative for those who prefer formats independent of Canonical. The VS Code version on Flathub is well-supported by both the community and Microsoft.
flatpak install flathub com.visualstudio.code
How to Completely Uninstall Visual Studio Code
If you decide to switch installation methods or no longer need the editor, use the commands below based on how you originally installed it:
Remove APT Version:
sudo apt remove --purge code
# To remove the repository and keys:
sudo rm /etc/apt/sources.list.d/vscode.list
sudo rm /etc/apt/keyrings/packages.microsoft.gpg
Remove Snap Version:
sudo snap remove code
Remove Flatpak Version:
flatpak uninstall com.visualstudio.code
Clean Up User Data (For all methods):
Even after uninstalling the app, your plugins and settings remain on the system. To wipe them completely:
rm -rf ~/.config/Code
rm -rf ~/.vscode
Visual Studio Code Keyboard Shortcuts
I believe the keyboard shortcuts listed below are some of the most useful for daily work in VS Code. Commands for commenting, duplicating, and deleting lines are especially helpful as they significantly speed up the code editing process. Of course, depending on your personal preferences and editor configuration, you can set your own combinations, but the basic commands remain universal and convenient for most developers.
How to press shortcuts like Ctrl + K Ctrl + S? This is a sequential press, not a simultaneous one! First, hold Ctrl and press K, but do not release Ctrl. Then, still holding Ctrl, press S. Now you can release the keys – the “Keyboard Shortcuts” window will open.
List of frequently used keyboard shortcuts in Visual Studio Code:
Working with Comments
- Toggle line comment → Ctrl + /
- Toggle block comment → Ctrl + Shift + A
Working with Lines
- Duplicate line → Shift + Alt + ↓ (down) / Shift + Alt + ↑ (up)
- Delete line → Ctrl + Shift + K
- Move line up/down → Alt + ↑ / Alt + ↓
Selection and Editing
- Select word → Ctrl + D
- Select all occurrences of word → Ctrl + Shift + L
- Select current line → Ctrl + L
- Select everything between brackets → Ctrl + Shift + M
- Split line at cursor → Ctrl + Enter
Working with Tabs
- New file → Ctrl + N
- Open file → Ctrl + O
- Close current tab → Ctrl + W
- Switch between tabs → Ctrl + Tab (forward) / Ctrl + Shift + Tab (back)
Search and Navigation
- Find in file → Ctrl + F
- Find and replace → Ctrl + H
- Go to line → Ctrl + G
- Go to file → Ctrl + P
Terminal
- Open terminal → Ctrl + `
- Close terminal → Ctrl + Shift + `
Frequently Asked Questions(FAQ)
Why can’t VS Code see Python, Node.js, or Git?
This is most often an issue with the Snap or Flatpak versions. The app runs in isolation and lacks access to folders like /usr/bin/ or /usr/local/bin/ without extra permissions. If you encounter this, it is better to reinstall using Method 1 (APT).
Can I install the Stable and Insiders versions simultaneously?
Yes. You can install the standard code via APT and code-insiders via Snap. They use different settings folders and do not conflict with each other.
How can I check if VS Code is installed and which version I have?
Simply type the following in your terminal:code --version
Conclusion
The best installation method depends on your specific needs. For serious development and seamless integration with system tools (GCC, Python, Docker), installing via the official APT repository remains the top choice. If you want the fastest setup with minimal commands, use Snap. In case of network blocks, always keep a trusted VPN service handy to ensure your workspace receives critical security updates.





Thanks for the guide — it helped me install VS Code on my system 👍
If possible, could you update this article for newer Ubuntu versions (like 22.04 / 24.04)? As a beginner, I’m not always sure which method is currently recommended, and an updated guide would be really helpful.
Thank you for your interest in the site. I’ve updated the installation.