How to install VS Code on Linux?

If you’re a developer, or even just someone who tinkers with code, chances are you’ve heard of Visual Studio Code. It’s a free, open-source code editor developed by Microsoft, and it’s become an absolute powerhouse in the development world. Seriously, its popularity isn’t just hype; it’s a meticulously crafted tool that offers an incredible blend of features, performance, and extensibility. For Linux users, knowing how to install VS Code on Linux is practically a rite of passage, opening up a world of efficient coding.
Why all the fuss? Well, VS Code isn’t just a text editor. It boasts robust debugging support, built-in Git control, intelligent code completion (IntelliSense), and a massive marketplace of extensions that can transform it into almost any IDE you need. Whether you’re wrangling Python, JavaScript, C++, Go, or something more esoteric, VS Code likely has you covered. And because it’s cross-platform, Linux users get the full, uncompromised experience. But unlike some software that’s a one-click affair, there are several distinct ways to install VS Code on Linux, each with its own quirks and advantages. Let’s break down the most common and effective methods.
1. Using the Official .deb Package on Debian/Ubuntu: The Classic Approach
For anyone running a Debian-based distribution like Ubuntu, Linux Mint, or Debian itself, the most straightforward and often preferred method to install VS Code on Linux is by downloading the official .deb package. This is Microsoft’s go-to recommendation for these systems, and for good reason. It’s a self-contained package that handles most dependencies and integrates well with your system’s package management.
The process starts with a quick trip to the official VS Code website. You’ll find a clear download link for the .deb file. Once downloaded, you can usually double-click it to open it with your distribution’s default software installer (like Ubuntu Software Center or GDebi). Alternatively, for those who prefer the command line, navigate to your Downloads directory and run sudo dpkg -i code_*.deb. After the initial installation, VS Code will also add its repository to your system, meaning future updates can be handled through your standard apt update && apt upgrade commands, keeping things wonderfully simple.
2. Installing via Snap on Ubuntu/Snap-enabled Distributions: The Containerized Future
Snaps are a universal Linux packaging system developed by Canonical, the creators of Ubuntu. They offer a containerized approach to software, bundling an application and all its dependencies into a single package. This makes installation incredibly consistent across different Linux distributions that support Snap, and it provides a degree of isolation from the rest of your system. For many Ubuntu users, using Snap to install VS Code on Linux is now the recommended default.
To install VS Code as a Snap, it’s a single command: sudo snap install --classic code. The --classic flag is important here; it grants the Snap package broader access to your system, which VS Code needs to function properly (e.g., accessing your project files). Snaps also handle updates automatically in the background, which is a huge convenience. While some developers have strong opinions about Snaps (pro and con), their ease of use and guaranteed isolation make them a compelling option for many, ensuring you always have the latest stable version without manual intervention.
3. Leveraging Flatpak for Broad Compatibility: Another Universal Option
Much like Snaps, Flatpak is another universal packaging system designed to simplify software distribution on Linux. It’s supported by a wide range of distributions and aims to solve the ‘dependency hell’ problem by isolating applications in sandboxed environments. If you’re using a distribution that doesn’t lean heavily on Snaps, or if you simply prefer Flatpak, it’s an excellent way to install VS Code on Linux.
First, you’ll need to ensure Flatpak is installed and configured on your system (most modern distributions come with it pre-installed or make it easy to add). Then, you’ll add the Flathub repository, which is the primary source for Flatpak applications: flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo. Finally, install VS Code with flatpak install flathub com.visualstudio.Code. Flatpak installations also benefit from automatic updates and consistent behavior across different systems, providing a robust and reliable way to get VS Code up and running.
4. Using the Official RPM Package for Fedora/RHEL/CentOS: For Red Hat Derivatives
If your Linux distribution belongs to the Red Hat family, such as Fedora, CentOS, or RHEL, you’ll be looking for the official .rpm package. RPMs (Red Hat Package Manager) are the standard package format for these systems, just as .deb files are for Debian-based ones. Microsoft provides a dedicated .rpm package on the VS Code download page, ensuring native integration.
After downloading the .rpm file, you can install it from your terminal using sudo dnf install code-*.rpm (for Fedora/RHEL 8+) or sudo yum install code-*.rpm (for older RHEL/CentOS versions). Similar to the .deb installation, this process also adds the official VS Code repository to your system’s package manager. This means that going forward, you can update VS Code simply by running sudo dnf update or sudo yum update, keeping your editor fresh and secure without extra hassle.
5. Adding the Official Repository and Installing via Package Manager: The Preferred System-Integrated Way
While downloading and installing individual .deb or .rpm files works, the most elegant and maintainable way to install VS Code on Linux for many users is by adding its official repository directly to their system’s package manager. This approach makes VS Code a first-class citizen in your software ecosystem, ensuring seamless updates alongside your other system software. (See: Wikipedia page on Visual Studio Code.)
For Debian/Ubuntu users, you’d typically add the GPG key and then the repository: 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 /etc/apt/trusted.gpg.d/ && sudo sh -c 'echo "deb [arch=amd64,arm64,armhf] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list' && rm packages.microsoft.gpg. Then, sudo apt update && sudo apt install code. For Fedora/RHEL, it’s simpler: sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc && sudo sh -c 'echo -e "[code]. Then,
name=Visual Studio Code
baseurl=https://packages.microsoft.com/yumrepos/vscode
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'sudo dnf install code. This method is highly recommended for its long-term stability and ease of maintenance.
6. Installing the Open-Source Version (VSCodium): For the Privacy-Conscious
While VS Code is open-source, the version distributed by Microsoft includes some proprietary components and telemetry. For developers who prefer a truly open-source experience without any Microsoft branding or telemetry, VSCodium is an excellent alternative. It’s a community-driven, freely licensed binary distribution of Microsoft’s VS Code that’s built from the official source without the proprietary bits.
The installation process for VSCodium mirrors that of VS Code, often with dedicated .deb, .rpm, Snap, and Flatpak packages available through its own channels. For example, to install VSCodium via Flatpak, you’d use flatpak install flathub com.vscodium.VSCodium. It provides the exact same core features, extensions, and user interface as VS Code, making the transition seamless. If you’re concerned about data privacy or simply prefer a fully FOSS (Free and Open Source Software) ecosystem, VSCodium is a fantastic choice when you want to install VS Code on Linux.
7. Using Arch Linux AUR (Arch User Repository): For Arch Enthusiasts
Arch Linux, known for its minimalism and user-centric approach, handles software a bit differently. While you can technically install VS Code through Flatpak or Snap, the more ‘Arch’ way is often to use the Arch User Repository (AUR). The AUR is a community-driven repository that contains PKGBUILDs (package build scripts) for thousands of applications not found in the official Arch repositories.
To install VS Code from the AUR, you’ll typically use an AUR helper like yay or paru. If you have yay installed, the command is as simple as yay -S visual-studio-code-bin. This will download the PKGBUILD, resolve dependencies, compile the package (if necessary, though -bin packages often just download pre-compiled binaries), and install it. The AUR provides a convenient way for Arch users to install and manage a vast array of software, including VS Code, while maintaining the Arch philosophy of building from source or using community-maintained packages.
8. Portable Installation (Extracting the Tarball): For Flexibility and Testing
Sometimes, you don’t want a full system installation. Maybe you’re testing a new version, running VS Code from a USB drive, or simply prefer a self-contained application that doesn’t touch your system’s package manager. In these scenarios, extracting the official tarball (.tar.gz) is your best bet to install VS Code on Linux.
Download the .tar.gz archive from the VS Code website. Then, extract it to a directory of your choice, perhaps ~/Applications/VSCode or directly onto a portable drive. Inside the extracted folder, you’ll find an executable named code. You can run VS Code directly from there: ~/Applications/VSCode/bin/code. This method offers unparalleled flexibility, as it doesn’t require root privileges for installation and can be easily moved or deleted without leaving system-level traces. However, it also means you’ll need to manually handle updates by downloading new tarballs and replacing the old installation.
Choosing the Right Method for You
With so many ways to install VS Code on Linux, how do you pick the best one? It really boils down to your distribution, your comfort level with the command line, and your personal preferences regarding system integration, automatic updates, and even privacy.
- For most Ubuntu/Debian users: The
.debpackage or adding the official repository (Method 1 or 5) offers the best integration and update experience. Snap (Method 2) is also a strong contender, especially if you like containerized apps and automatic updates. - For Fedora/RHEL users: The
.rpmpackage or adding the official repository (Method 4 or 5) is the way to go for native integration. - For users of other distributions or those preferring universal packages: Flatpak (Method 3) is a solid, widely supported choice.
- For privacy-conscious users: VSCodium (Method 6) is the clear winner, offering all the features without the proprietary telemetry.
- For Arch Linux users: The AUR (Method 7) is often the preferred and most integrated method within the Arch ecosystem.
- For temporary use, testing, or portability: The tarball extraction (Method 8) provides maximum flexibility.
No matter which method you choose, getting VS Code running on your Linux machine is a gateway to a significantly more productive and enjoyable coding experience. Its versatility, powerful features, and extensive ecosystem of extensions make it an indispensable tool for almost any developer. So, pick your preferred installation path and get ready to supercharge your development workflow!
Deep Dive: Why VS Code Excels on Linux
It’s worth taking a moment to appreciate why VS Code has become such a darling among Linux developers. Beyond its cross-platform nature, several factors contribute to its stellar performance and integration on Linux systems. First, its Electron framework, while sometimes criticized for resource usage, ensures a consistent UI/UX across operating systems. This means a developer using VS Code on Windows, macOS, or Linux will find the same menus, shortcuts, and overall feel, reducing friction when switching environments.
Second, the terminal integration in VS Code is particularly powerful on Linux. Linux users live in the terminal, and having a fully functional, integrated terminal directly within the editor means less context switching. You can run build commands, Git operations, or even start a local server without ever leaving your code window. This seamless workflow is a huge productivity booster.
Third, VS Code’s extension ecosystem thrives on Linux. Many popular extensions, especially those for languages like Python, Node.js, and Go, often rely on underlying system tools and compilers that are native to Linux. This synergy allows extensions to perform optimally and offer a richer feature set. For instance, debugging C++ applications often involves GDB, which is a staple on Linux, and VS Code’s C++ extension leverages this beautifully.
Finally, the open-source nature of VS Code itself resonates deeply with the Linux community’s ethos. Even with Microsoft’s proprietary additions, the core editor being open source fosters trust and allows for community contributions and alternatives like VSCodium, giving users choice and control. (See: Centers for Disease Control and Prevention.)
Optimizing Your VS Code Setup on Linux
Once you’ve got VS Code installed on Linux, you’ll want to tweak it for maximum efficiency. Here are a few tips:
Install Essential Extensions
The true power of VS Code comes from its extensions. Here are some universally useful ones:
- ESLint/Prettier: For JavaScript/TypeScript developers, these are crucial for code formatting and linting, ensuring consistent code style across your projects.
- Python: The official Microsoft Python extension provides rich features like IntelliSense, debugging, and testing for Python development.
- GitLens: Supercharges Git capabilities, showing you who wrote each line of code, commit history, and more.
- Docker: If you work with containers, this extension helps manage Docker images, containers, and even build Dockerfiles directly from VS Code.
- Remote – SSH: This is a game-changer for Linux users. It lets you open any folder on a remote machine using SSH and work with it as if it were local. This is incredibly useful for server-side development or working on cloud instances.
- Live Server: Perfect for front-end developers, it launches a local development server with live reload features.
Customize Keybindings and Settings
VS Code is highly customizable. Take some time to explore File > Preferences > Keyboard Shortcuts and File > Preferences > Settings. You can remap shortcuts to match your muscle memory or adjust editor behavior like font size, tab spaces, and theme. Many Linux users prefer a dark theme, and VS Code offers a plethora of options out of the box and through extensions.
Leverage Integrated Terminal
As mentioned, the integrated terminal (Ctrl+` or Cmd+`) is your friend. You can have multiple terminals open, split them, and use your preferred shell (Bash, Zsh, Fish). This reduces the need to switch between your editor and a separate terminal window.
Git Integration
VS Code’s Git integration is top-notch. You can stage changes, commit, switch branches, and even resolve merge conflicts graphically, all within the editor. Paired with an extension like GitLens, it becomes an incredibly powerful version control hub.
Troubleshooting Common Installation Issues
Even with clear instructions, sometimes things go sideways. Here are a few common issues you might encounter when you install VS Code on Linux and how to fix them:
- Missing Dependencies: If you’re using a
.debor.rpmpackage and it fails, it might be due to unmet dependencies. Try runningsudo apt install -f(Debian/Ubuntu) orsudo dnf check-update && sudo dnf install(Fedora/RHEL) after a failed installation to try and fix broken packages. - GPG Key Errors: When adding repositories, you might get an error about a missing or untrusted GPG key. Double-check the GPG key import command. Sometimes, a network issue can prevent the key from being fetched correctly.
- Snap/Flatpak Permissions: If VS Code installed via Snap or Flatpak can’t access certain directories or devices, it’s usually a sandboxing issue. For Snaps, ensure you used the
--classicflag. For Flatpak, you might need to useflatpak override --user --filesystem=/path/to/directory com.visualstudio.Codeto grant specific directory access. - “Code” command not found: If you installed via tarball or a manual method, the
codeexecutable might not be in your system’s PATH. You can either add the directory containingcodeto your PATH environment variable or create a symbolic link:sudo ln -s /path/to/VSCode/bin/code /usr/local/bin/code. - Update Issues: If updates aren’t working, especially with repository installations, ensure the repository entry in your
sources.list.doryum.repos.dis correct and that the GPG key is still valid. Runningsudo apt updateorsudo dnf updateshould show any errors.
Expert Perspective: The Role of VS Code in the Linux Ecosystem
From an expert’s standpoint, VS Code’s rise on Linux isn’t just about its features; it represents a significant shift in how developers interact with their operating systems. Traditionally, Linux development was often associated with Vim, Emacs, or full-blown IDEs like Eclipse or IntelliJ. While those tools remain powerful, VS Code offers a lighter, faster, and arguably more modern alternative that bridges the gap between a simple text editor and a heavy IDE.
The “editor-first” approach, where the core is lean and functionality is added via extensions, aligns well with the modular philosophy of Linux itself. Developers can tailor their environment precisely to their needs, avoiding bloat. This flexibility, combined with its strong support for containerization (Docker, Kubernetes) and cloud development (Remote – SSH), makes it an ideal tool for the modern, distributed development landscape that heavily relies on Linux servers and cloud infrastructure.
Furthermore, VS Code’s accessibility has lowered the barrier to entry for many new Linux users. It provides a familiar, polished environment that newcomers from Windows or macOS can quickly adapt to, making the transition to a Linux development workstation much smoother. This broad appeal contributes to the continued growth and adoption of Linux in professional development settings.
Future Trends: What’s Next for VS Code on Linux?
Looking ahead, we can expect VS Code to continue evolving its Linux integration. We’ll likely see further enhancements in areas like: (See: New York Times Technology Section.)
- Wayland Support: As Wayland replaces X11 as the default display server on more Linux distributions, better native support and performance for VS Code under Wayland will be a focus.
- ARM Architecture: With the rise of ARM-based devices, including single-board computers like the Raspberry Pi and ARM-powered laptops, VS Code’s ARM builds will become even more optimized and crucial.
- Cloud Integration: Deeper integration with cloud development environments and remote Linux instances will become standard, simplifying workflows for developers working across hybrid environments.
- Performance Optimizations: Continuous efforts to reduce Electron’s resource footprint and improve startup times will benefit all users, especially those on less powerful Linux hardware.
Frequently Asked Questions (FAQ)
Q: Is VS Code truly open source?
A: Yes, the core source code of VS Code is open source under the MIT License. However, the official Microsoft-distributed builds include some proprietary assets (like Microsoft branding) and telemetry features. If you want a purely open-source version, VSCodium (Method 6) is the way to go.
Q: Can I use VS Code for commercial projects on Linux?
A: Absolutely. VS Code is free for commercial and private use. Its MIT license is very permissive, allowing you to use it in any context without royalties or restrictions.
Q: How do I update VS Code after installation on Linux?
A: It depends on your installation method:
- .deb/.rpm package or Official Repository: Use your system’s package manager (
sudo apt update && sudo apt upgradefor Debian/Ubuntu;sudo dnf updatefor Fedora/RHEL). - Snap: Updates are handled automatically in the background.
- Flatpak: Run
flatpak update. - AUR (Arch Linux): Use your AUR helper (e.g.,
yay -Syu). - Tarball (Portable): You need to manually download the new tarball and replace your existing installation.
Q: Does VS Code support Linux ARM processors (like Raspberry Pi)?
A: Yes! Microsoft provides official ARM builds (armhf and arm64) for .deb packages, and Snap and Flatpak often support ARM architectures as well. This makes VS Code a great choice for developing on devices like the Raspberry Pi.
Q: I prefer Vim/Emacs keybindings. Can I use them in VS Code?
A: Yes! There are excellent extensions available in the VS Code marketplace that emulate Vim and Emacs keybindings, allowing you to retain your muscle memory while enjoying VS Code’s features. Simply search for “Vim” or “Emacs” in the extensions view.
Q: What if I install VS Code using multiple methods?
A: It’s generally not recommended to install the same application using multiple package managers (e.g., both Snap and Flatpak, or both .deb and Snap). This can lead to confusion about which version is launching, how updates are handled, and potential conflicts. Stick to one preferred method for consistency.
Q: How do I uninstall VS Code from Linux?
A: The uninstallation method mirrors the installation method:
- .deb package or Official Repository:
sudo apt remove code(Debian/Ubuntu) - .rpm package or Official Repository:
sudo dnf remove code(Fedora/RHEL) - Snap:
sudo snap remove code - Flatpak:
flatpak uninstall com.visualstudio.Code - AUR (Arch Linux):
yay -R visual-studio-code-bin(or your AUR helper’s remove command) - Tarball (Portable): Simply delete the directory where you extracted the tarball.
With these comprehensive details, you’re not just equipped to install VS Code on Linux, but also to truly understand its place in the development landscape, optimize it for your workflow, and troubleshoot any bumps along the way. Happy coding!
Trending Now
Frequently Asked Questions
How do I install Visual Studio Code on Linux?
To install Visual Studio Code on Linux, you can download the official .deb package from the VS Code website if you're using a Debian-based distribution like Ubuntu. Simply double-click the downloaded file to open it with your system's installer, or use terminal commands to install it via APT.
What are the system requirements for installing VS Code on Linux?
VS Code requires a 64-bit version of Linux and a modern desktop environment. The minimum RAM is 1 GB, but 2 GB is recommended. Ensure you have a supported version of libraries like libc and libX11 for the best performance.
Can I install VS Code using the terminal on Linux?
Yes, you can install VS Code using the terminal on Linux. For Debian-based systems, you can use commands like 'sudo apt update' followed by 'sudo apt install code' after adding the Microsoft repository to your package manager.
What are the benefits of using VS Code on Linux?
VS Code offers numerous benefits on Linux, including robust debugging support, built-in Git control, and intelligent code completion through IntelliSense. Its extensive marketplace allows users to install extensions that enhance functionality for various programming languages.
Is Visual Studio Code free to use on Linux?
Yes, Visual Studio Code is completely free and open-source on Linux. You can download and use it without any cost, making it an excellent choice for developers and programmers looking for a powerful code editor.
What's your take on this? Share your thoughts in the comments below — we read every one.




