How to Install Visual Studio Code on Ubuntu
Install Visual Studio Code on Ubuntu from the .deb package, as a snap or from the Microsoft repository, keep it updated, and edit files on a remote server.
3 min readBy Daniel
Reviewed by the AmazingRDP technical team

Edit on your desktop, run on a server. A Linux VPS gives you root access over SSH. See Linux VPS from $6.99
Visual Studio Code is Microsoft's free code editor and the most widely used editor among developers. It runs on Ubuntu like any desktop application. There are three ways to install it; they give the same program and differ in how updates arrive.
Which way?
| Method | Updates | Choose it when |
|---|---|---|
The .deb package | With normal system updates (it adds Microsoft's repository) | You want the standard setup. Recommended |
| Snap | Automatic, in the background | You want one command and no questions |
| Repository by hand | With system updates | You are scripting the setup of several machines |
Method 1: the .deb package
- Open code.visualstudio.com and download the
.debfile for Ubuntu. - Install it from a terminal in the Downloads folder:
cd ~/Downloads
sudo apt install ./code_*.deb
During installation it asks whether to add Microsoft's repository so that updates arrive with apt. Answer yes.
Method 2: snap
sudo snap install code --classic
Or search for "Visual Studio Code" in the App Center. --classic gives the editor the access to your files and tools that a code editor needs.
Method 3: add the repository yourself
sudo apt install wget gpg apt-transport-https
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -D -o root -g root -m 644 microsoft.gpg /usr/share/keyrings/microsoft.gpg
echo "deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/code stable main" | sudo tee /etc/apt/sources.list.d/vscode.list
sudo apt update
sudo apt install code
These are the steps Microsoft publishes; if one fails, compare with the current version on the VS Code website, since key locations change now and then.
Start it
From the applications menu, or from a terminal in a project folder:
code .
First things to set up
- Extensions (
Ctrl + Shift + X): language support for what you write, such as Python, and a formatter. - The Command Palette (
Ctrl + Shift + P) reaches every function by name. - The built-in terminal (
Ctrl + `). - Git is used through the Source Control view; install it with
sudo apt install git. On Windows, see installing Git. - Settings Sync carries your settings and extensions to your other machines.
Edit files on a remote server
This is the feature that matters for server work. Do not install a desktop and VS Code on the server. Install the Remote - SSH extension on your own computer instead:
- Install the extension "Remote - SSH" from Microsoft.
- Open the Command Palette and choose Remote-SSH: Connect to Host.
- Enter
user@server-address, or pick a host from your~/.ssh/config. - Open a folder on the server.
The window now edits the server's files, its terminal runs on the server, and extensions for your language run there too. The interface stays on your machine, so it feels local even on a slow line. Key login makes it comfortable: see setting up SSH keys.
Two things to know. The extension installs a helper on the server that needs a few hundred megabytes of memory, so on a server with 1 GB it can struggle; and it needs a reasonably current Linux on the server. For very small servers, edit with nano or mount the folder over SFTP.
Update and remove
| Installed as | Update | Remove |
|---|---|---|
.deb or repository | sudo apt update && sudo apt upgrade | sudo apt remove code |
| Snap | Automatic | sudo snap remove code |
Your settings live in ~/.config/Code and your extensions in ~/.vscode; they stay until you clear those folders.
Problems
| Sign | Cause |
|---|---|
code: command not found | Installed as a snap and /snap/bin is not in the PATH yet; log out and in |
| Typing in other languages or the system file dialog misbehaves (snap) | A limit of the snap packaging. Use the .deb |
| Remote-SSH: "could not establish connection" | Test plain ssh in a terminal first. Then check free memory and disk space on the server |
| Two versions installed | Remove one: the snap and the .deb do not share updates |
Alternatives
VSCodium is the same editor built without Microsoft's telemetry and branding; a few Microsoft extensions do not work with it. For Node.js projects, see NVM to manage versions. For a server to connect to, see our Linux VPS plans.
Questions
How do I install VS Code on Ubuntu?
Download the .deb file from code.visualstudio.com and run sudo apt install ./code_*.deb, or run sudo snap install code --classic.
Is Visual Studio Code free?
Yes. It is free to use, including for commercial work.
How do I edit files on a server with VS Code?
Install the Remote - SSH extension on your own computer and connect to the server with it. Nothing graphical is needed on the server.
How do I update VS Code on Ubuntu?
The .deb installation updates with sudo apt upgrade. The snap updates by itself.