Installing Visual Studio Code on Ubuntu

Mascote do LinuxPro digitando no teclado diante do editor de código, com o logo do Visual Studio Code ao lado

Note (2026): the original post, from 2017, installed VS Code by downloading a .deb standalone file and mixed up two different products. It has been rewritten: the correct method today is the official apt repository, which updates along with the system — and it is worth knowing there is an alternative build without telemetry.

The Visual Studio Code is the most widely used editor in the world, runs well on Linux and is free. This guide shows how to install it in a way that stays up to date automatically, what to do next and the difference between the Microsoft binary and VSCodium.

First: VS Code is not Visual Studio

The names are confusing, but they are different products:

  • Visual Studio Code — a lightweight, cross-platform code editor, written in TypeScript on Electron. This is the one that runs on Linux.
  • Visual Studio (without “Code”) — Microsoft’s heavyweight IDE for .NET, C++ and C#, in Community, Professional and Enterprise editions. It does not exist for Linux. Anyone who needs .NET on Linux uses the SDK from the command line — the topic of the post installing .NET on Linux — with VS Code on top.

Installing from the official repository (recommended)

This is the right path: register the Microsoft repository, and from then on the editor updates along with the system’s `apt upgrade`, without hunting for a new `.deb` for each version.

sudo apt install wget gpg

wget -qO- https://packages.microsoft.com/keys/microsoft.asc 
  | sudo gpg --dearmor -o /usr/share/keyrings/microsoft.gpg

Now the repository file. Recent distributions use the format deb822, more readable than the old single line:

sudo tee /etc/apt/sources.list.d/vscode.sources > /dev/null <<'FIM'
Types: deb
URIs: https://packages.microsoft.com/repos/code
Suites: stable
Components: main
Architectures: amd64,arm64,armhf
Signed-By: /usr/share/keyrings/microsoft.gpg
FIM

sudo apt update
sudo apt install code

Notice Architectures: in addition to the usual amd64 , the repository serves arm64. In other words, it works on a Raspberry Pi 4/5 with 64 bits and on ARM servers, not just on PCs.

Other methods

# snap (vem pronto no Ubuntu)
sudo snap install --classic code

# flatpak, pela Flathub
flatpak install flathub com.visualstudio.code

# .deb avulso, quando você precisa de uma versão específica
sudo apt install ./code_1.XX.X_amd64.deb

The --classic in snap is not decorative: without it the editor is confined and cannot see your files or the compilers installed on the system. Flatpak has the same sandbox limitation and requires granting folder access — for an editor, which needs to reach the entire project and build tools, the apt repository remains the path of least resistance.

VSCodium: the same editor, without telemetry

Here is the part the 2017 post did not mention. The VS Code source code is on github.com/microsoft/vscode under MIT license. But the binary Microsoft distributes is not just that compiled code: at build time it adds what its own documentation calls “Microsoft-specific functionality” — telemetry, the extension gallery and branding — and distributes it under a proprietary license.

The VSCodium is exactly the same source code compiled without those additions: MIT binary, telemetry disabled. Install it the same way:

wget -qO- https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg 
  | gpg --dearmor 
  | sudo dd of=/usr/share/keyrings/vscodium-archive-keyring.gpg

sudo tee /etc/apt/sources.list.d/vscodium.sources > /dev/null <<'FIM'
Types: deb
URIs: https://download.vscodium.com/debs
Suites: vscodium
Components: main
Architectures: amd64 arm64
Signed-by: /usr/share/keyrings/vscodium-archive-keyring.gpg
FIM

sudo apt update
sudo apt install codium

The trade-off: the official Microsoft marketplace has terms of use that only allow its own client, so VSCodium points to Open VSX, an open catalog. Most popular extensions are there, but some — generally Microsoft’s own, such as those for C++ and remote access — are not. Before migrating, check whether the extension you depend on exists on Open VSX.

After installation

The first practical benefit is opening a project directly from the terminal, without going through the file manager:

code .                    # abre a pasta atual como projeto
code arquivo.py           # abre um arquivo
code --diff a.txt b.txt   # compara dois arquivos lado a lado
code --list-extensions    # o que você já tem instalado

Extensions from the command line, useful for reproducing your environment on a new machine:

code --install-extension ms-python.python
code --install-extension golang.go
code --install-extension rust-lang.rust-analyzer

# levar sua lista para outra máquina
code --list-extensions > extensoes.txt
xargs -n1 code --install-extension < extensoes.txt

And the feature that turns the editor into a server administration tool: Remote — SSH. With it you open a folder on a remote server and edit as though it were local — with syntax highlighting, an integrated terminal and a debugger running there, not here. For anyone who administers Linux machines over SSH, it is the difference between editing YAML in vim over a slow connection and having the entire project open on screen.

code --install-extension ms-vscode-remote.remote-ssh
# depois: F1 → "Remote-SSH: Connect to Host" → usa o seu ~/.ssh/config

It reads your ~/.ssh/config, so the host aliases you already use appear in the list. This is one of the extensions not on Open VSX — a concrete case where Microsoft’s build wins over VSCodium.

Shortcuts worth learning

  • Ctrl+P — open a file by name without taking your hands off the keyboard
  • Ctrl+Shift+P — the command palette: everything the editor can do, searchable by text
  • Ctrl+` — toggle the integrated terminal
  • Ctrl+Shift+F — search all project files
  • F2 — rename a symbol throughout the project, respecting scope
  • Alt+clique — multiple cursors, to edit several lines at once

To keep going