GICT knowledge base
How to Use Visual Studio Code (VS Code) on Linux: Complete Installation, Setup, and Productivity Guide
Published
Linux is a favorite platform for developers, system administrators, and tech enthusiasts because of its flexibility, control, and open-source nature. When it comes to writing code, managing projects, or editing configuration files, Visual Studio Code (VS Code) stands out as a top choice for a modern, fast, and fully-featured code editor. Developed by Microsoft as a free and open-source project, VS Code has rapidly become the editor of choice for programmers on every major operating system, including Linux.
If you’re new to VS Code or Linux, or just want to make sure you’re getting the most out of your setup, this guide is for you. You’ll learn how to install VS Code using several methods, configure it for your workflow, install extensions to support any language, integrate with Git, troubleshoot problems, and discover tips to boost your productivity.
Table of Contents
- What is Visual Studio Code?
- Why Use VS Code on Linux?
- Prerequisites
- How to Install VS Code on Linux
- Launching and Updating VS Code
- Setting Up Your First Project in VS Code
- Installing and Managing Extensions
- Customizing VS Code for Your Workflow
- Using VS Code for Different Programming Languages
- Using the Integrated Terminal
- Integrating Git and Version Control
- Popular Productivity Tips and Shortcuts
- Troubleshooting Common Issues
- Frequently Asked Questions (FAQ)
- Conclusion
1. What is Visual Studio Code?
Visual Studio Code (VS Code) is a lightweight, open-source, cross-platform code editor designed for modern development. It offers robust support for code editing in dozens of languages, debugging, syntax highlighting, intelligent code completion (IntelliSense), integrated terminal, source control, and a huge ecosystem of extensions. Unlike full IDEs, VS Code is fast, portable, and highly customizable—making it perfect for both quick edits and large projects.
2. Why Use VS Code on Linux?
- Cross-Platform Consistency: Use the same editor and settings on Linux, Windows, and macOS.
- Performance: Lightweight and fast, even on modest hardware.
- Extensions: Access thousands of language packs, linters, debuggers, and tools.
- Integrated Tools: Built-in terminal, source control, and debugging.
- Customization: Themes, keybindings, workspace layouts, and more.
- Community Support: Active forums, tutorials, and helpful documentation.
Whether you’re a web developer, Python coder, sysadmin, or just need a flexible text editor, VS Code is up to the task.
3. Prerequisites
Before installing VS Code on Linux, you should have:
- A Linux system (Ubuntu, Debian, Fedora, CentOS, openSUSE, Arch, etc.).
- Administrative (sudo) rights to install packages, unless using Snap or Flatpak.
- Internet access for downloading and installing packages and extensions.
4. How to Install VS Code on Linux
Method 1: Download and Install the .deb or .rpm Package
For Ubuntu, Debian, Linux Mint (.deb)
Go to the official VS Code website.
Download the .deb package.
Open a terminal and navigate to your download directory:
cd ~/Downloads
Install the package:
sudo apt install ./code_*.deb
Once installed, launch VS Code by typing:
code
For Fedora, RHEL, CentOS (.rpm)
Download the .rpm package from the VS Code download page.
In your terminal:
cd ~/Downloads
sudo dnf install code-*.rpm
For openSUSE
You can use the .rpm package or the openSUSE repositories.
Method 2: Install VS Code via Snap
Snap is a universal package system supported by most distributions.
If snapd isn’t installed:
sudo apt install snapd
Install VS Code:
sudo snap install --classic code
Start VS Code:
code
Method 3: Install VS Code via Flatpak
Flatpak is another cross-distro package system.
Install Flatpak if needed:
sudo apt install flatpak
Add the Flathub repository:
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Install VS Code:
flatpak install flathub com.visualstudio.code
Launch with:
flatpak run com.visualstudio.code
Method 4: Install from the Official Repository (Ubuntu/Debian)
Import the Microsoft GPG key:
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 /usr/share/keyrings/
Add the repository:
sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
Install VS Code:
sudo apt update
sudo apt install code
5. Launching and Updating VS Code
Launching VS Code
Type code in your terminal, or search “Visual Studio Code” in your application launcher/menu.
If you installed with Flatpak, use:
flatpak run com.visualstudio.code
Updating VS Code
If you used Snap or Flatpak, updates are automatic.
If you installed via .deb/.rpm or repository, update with:
sudo apt update && sudo apt upgrade
or
sudo dnf upgrade
6. Setting Up Your First Project in VS Code
- Open a Folder: Go to File > Open Folder or use
Ctrl+K Ctrl+Oto open your project directory. - Create and Edit Files: Right-click in the Explorer sidebar to add files/folders.
- Save Your Work: Use
Ctrl+Sto save the current file.
Tip: VS Code remembers your open projects and files for the next session.
7. Installing and Managing Extensions
Extensions add language support, tools, themes, and productivity features.
How to Add Extensions
Click the Extensions icon in the sidebar (or press Ctrl+Shift+X).
Search for what you need (e.g., Python, Prettier, Docker).
Click Install.
Must-have Extensions:
- Python (Microsoft)
- C/C++ (Microsoft)
- Prettier – Code Formatter
- ESLint (for JavaScript/TypeScript)
- GitLens (advanced Git)
- Docker
- Markdown All in One
Managing Extensions
- Enable/disable extensions from the Extensions sidebar.
- Remove extensions by clicking the gear icon > Uninstall.
- Configure extension settings via File > Preferences > Settings.
8. Customizing VS Code for Your Workflow
VS Code is highly customizable. Here are some ways to make it fit your needs:
Themes and Appearance
Install themes from the Extensions marketplace (search themes like “One Dark Pro,” “Dracula,” or “Monokai”).
Change theme: Ctrl+K Ctrl+T
Keyboard Shortcuts
Edit shortcuts under File > Preferences > Keyboard Shortcuts or with Ctrl+K Ctrl+S.
You can import keymaps from other editors (e.g., Sublime, Atom, Vim) using extensions.
Settings
Access via File > Preferences > Settings or Ctrl+,.
Use the search bar to find and adjust settings, such as font size, tab width, line numbers, etc.
Toggle between User (global) and Workspace (project-specific) settings.
Settings Sync
Sign in with a Microsoft or GitHub account to sync your settings, extensions, and keybindings across devices.
9. Using VS Code for Different Programming Languages
VS Code supports many languages out of the box. Installing language-specific extensions gives you features like IntelliSense, linting, and debugging.
Python
- Install the Python extension.
- Get code completion, linting, debugging, and interactive Jupyter notebooks.
- Easily set Python interpreters and virtual environments.
JavaScript/TypeScript
- Built-in support for syntax highlighting, refactoring, and debugging.
- Add ESLint for linting and Prettier for formatting.
C/C++ and Go
- Install the C/C++ or Go extension.
- Get code navigation, IntelliSense, and debugging.
Java, Rust, PHP, Ruby, and Others
- Search for official or community-supported extensions.
- Many provide project templates, build integration, and testing tools.
10. Using the Integrated Terminal
The integrated terminal lets you run shell commands without leaving the editor.
Open with Ctrl+`.
Supports Bash, Zsh, Fish, and other shells installed on your system.
You can open multiple terminals, rename them, and split panes.
Why use it? Run build commands, test scripts, manage Git, or even edit files with nano/vim—all without leaving VS Code.
11. Integrating Git and Version Control
VS Code’s built-in Git support makes tracking changes, committing, and pushing code easy.
Basic Git Operations
- Open the Source Control panel (branch icon in the sidebar).
- Initialize a repository, or VS Code detects one automatically.
- Stage, commit, and push changes with intuitive buttons.
- View diffs of changes before committing.
Advanced Git Features
- Create, switch, and merge branches.
- Resolve merge conflicts with visual tools.
- View file and line histories.
Tip: Install GitLens for features like blame annotations, advanced history, and rich integration with GitHub or other services.
12. Popular Productivity Tips and Shortcuts
- Command Palette:
Ctrl+Shift+Popens the command palette for quick access to commands and settings. - Multi-Cursor Editing:
Alt+Clickto place multiple cursors.Ctrl+Dto select the next instance of the word under your cursor. - Quick File Navigation:
Ctrl+Pto quickly open files by name. - Go to Definition/Reference:
F12or right-click > “Go to Definition.” - Side-by-Side Editing: Drag files to split the editor or use
Ctrl+\. - Zen Mode / Distraction-Free:
Ctrl+K Ztoggles Zen Mode to focus on coding.
13. Troubleshooting Common Issues
VS Code Won’t Launch
Try running code --verbose in the terminal to see detailed logs.
For Flatpak or Snap installs, use the full command: flatpak run com.visualstudio.code or snap run code.
Command Not Found
Ensure /usr/bin, /snap/bin, or /var/lib/flatpak/exports/bin is in your PATH.
Reinstall or link the code binary if needed.
Can’t Install Extensions
Check your internet connection.
If behind a proxy, set proxy details in VS Code: File > Preferences > Settings > http.proxy
File Permission Issues
Run VS Code as your user (not with sudo).
Make sure your user owns and has access to your project files.
Missing Features or Language Support
Install recommended extensions for your project’s language.
Check extension settings for further configuration.
14. Frequently Asked Questions (FAQ)
- Q: Is Visual Studio Code free for Linux?
A: Yes, VS Code is free and open-source for Linux users. - Q: Can I use VS Code for remote development on Linux?
A: Yes! Use the “Remote – SSH” extension to code on remote servers directly from your local VS Code interface. - Q: How do I uninstall VS Code?
A: Use your package manager (sudo apt remove code,sudo dnf remove code, orsudo snap remove code). - Q: Does VS Code support plugins from other editors?
A: Keymaps for editors like Vim, Emacs, Sublime, and Atom are available as extensions. - Q: Can I run VS Code on a minimal or headless Linux system?
A: VS Code requires a graphical environment, but the “code-server” project or SSH extensions let you use it remotely.
15. Conclusion
Visual Studio Code brings modern code editing, debugging, version control, and customization to Linux while remaining lightweight and fast. Its huge extension marketplace and flexible configuration make it suitable for any project, from scripting and web development to embedded programming or DevOps automation.
By following this guide, you’ve learned how to install VS Code on Linux, set up projects, use extensions, customize your workflow, integrate Git, and troubleshoot common issues. With these skills, you can turn your Linux system into a highly productive, enjoyable, and professional development environment.
Keep exploring! Try new extensions, experiment with themes, and use keyboard shortcuts to make VS Code uniquely yours. If you run into problems or want to dive deeper into advanced features, check the official documentation, explore online forums, or ask the open-source community for help.
Related guides
How to Set Up zram on a Small VPS
Configure zram on Ubuntu with kernel and swap checks. Understand compressed memory limits, monitor real use and avoid unsafe swap-file changes.
LinuxHow to Find Services That Need a Restart After Updates with needrestart
Find services using outdated libraries with needrestart on Ubuntu. Read restart reports, review automatic restart policy and plan maintenance safely.
LinuxHow to Limit a Linux Service’s Memory with systemd
Limit a Linux service with systemd MemoryHigh, MemoryMax and swap controls. Check cgroup support, diagnose pressure and remove only your own policy.
LinuxHow to Protect SSH with CrowdSec on Ubuntu
Protect SSH with CrowdSec on Ubuntu. Connect log detection to firewall enforcement and test temporary blocking without losing administrator access.
