Installing and Using Visual Studio Code on Ubuntu

Visual Studio Code is a flexible code editor for Ubuntu, whether you are learning Python in Brisbane, maintaining a website in Melbourne, or managing scripts on a home server in Perth. It starts quickly, supports a wide range of programming languages, and can be extended with tools for debugging, version control, containers, and remote development.

Ubuntu users have several ways to install VS Code, including the Snap package, the official Microsoft repository, and a downloaded Debian package. Each method has practical advantages. Snap is quick and convenient, while the Microsoft repository generally integrates neatly with regular apt updates and makes it easy to receive newer releases.

The editor is also useful beyond software development. You can use it to edit Markdown notes, YAML configuration files, shell scripts, HTML, CSS, and JSON documents. Its built-in terminal and file browser make it a practical desktop tool for everyday Linux administration.

This guide covers installation, first-run configuration, extensions, project organisation, and common fixes. It also explains how to keep the setup comfortable on Ubuntu desktops, from a standard GNOME installation to a lighter environment on an older laptop.

Choosing the right installation method

The Snap package is the simplest choice on a current Ubuntu release. Snap is included with standard Ubuntu Desktop installations, so the command is short:

sudo snap install code --classic

The --classic option grants the editor the broader access it needs to work with project files, development tools, and terminals. Once installation finishes, open the applications menu and search for “Visual Studio Code”, or start it from a terminal with code.

The official Microsoft repository is a good alternative if you prefer software managed through apt. It offers regular package updates and is convenient on systems where you already use repository-based administration. Downloading the .deb package from the Visual Studio Code website is another option, particularly when you want to install a specific release manually, although it leaves update management more dependent on your own routine.

Installing from the Microsoft repository

Before adding a repository, update Ubuntu’s package information and install the tools needed to handle signing keys:

sudo apt update
sudo apt install wget gpg apt-transport-https

Create a keyring directory and import Microsoft’s signing key:

sudo install -d -m 0755 /etc/apt/keyrings
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | \
  gpg --dearmor | sudo tee /etc/apt/keyrings/packages.microsoft.gpg > /dev/null

Add the Visual Studio Code 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

Then install the editor:

sudo apt update
sudo apt install code

This approach works well on supported Ubuntu releases, including Ubuntu 24.04 LTS, and keeps VS Code in the same general maintenance flow as other packages. If you later decide to switch from Snap to the repository version, remove the Snap package first with sudo snap remove code to avoid confusion between two installations.

Getting comfortable with the interface

When VS Code opens for the first time, the left-hand Activity Bar provides access to Explorer, Search, Source Control, Run and Debug, and Extensions. The Explorer is where you open project folders, rather than individual files whenever possible. Opening the complete folder gives the editor a clear workspace and lets extensions discover project settings.

Use File > Open Folder to select a project directory. Ubuntu’s home folder is usually the safest place for personal work, such as ~/Projects, while system directories like /etc and /usr should be edited carefully. If a file requires administrator privileges, it is usually better to copy configuration files to a working location, edit them, and then install them with an appropriate command rather than running the entire editor as root.

The integrated terminal can be opened with Terminal > New Terminal. It normally starts in the active workspace folder, which saves repeated cd commands. You can choose Bash, Zsh, or another installed shell from the terminal profile menu. On a standard Ubuntu setup, Bash is a reliable default for package commands, Git operations, and small automation scripts.

Adding extensions without clutter

Extensions give VS Code support for languages and workflows that are not included in the basic installation. Open the Extensions view and search for tools such as Python, Docker, YAML, Markdown linting, or remote development. Read the publisher name and description before installing, since popular extension names can have similarly named alternatives.

For Python work, the Microsoft Python extension provides syntax support, environment selection, testing integration, and debugging. You will generally also want Python installed through Ubuntu or a virtual environment. A project can then use a local environment created with:

python3 -m venv .venv
source .venv/bin/activate

After selecting the interpreter from the command palette, VS Code can use that environment for running and checking code. Similar language-specific extensions are available for JavaScript, Java, C++, Rust, PHP, and Go. Keep the extension list focused: too many background services can slow startup, increase memory use, and make troubleshooting harder on modest hardware.

If your work includes planning documentation or maintaining personal notes, a practical writing guide can complement VS Code’s Markdown preview and workspace features. Markdown files can be previewed beside their source with the preview command in the editor, making the application useful for project notes as well as code.

Managing projects with Git

Git support is built into VS Code’s Source Control view, but Git itself may need to be installed:

sudo apt update
sudo apt install git

Set your identity once on the machine:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Open a Git repository as a folder and the Source Control panel will show changed files. You can review differences, stage selected changes, write a commit message, and create a commit without leaving the editor. The command palette and integrated terminal remain available when you need a less visual workflow.

For a new project, the usual sequence is to create a directory, initialise Git, add files, and commit the initial state:

mkdir my-project
cd my-project
git init
code .

The code . command opens the current directory in VS Code. If Ubuntu says that code cannot be found, close and reopen the terminal after installation, or check whether the selected installation method created the command-line launcher correctly.

Adjusting settings for Ubuntu

VS Code stores user settings separately from individual projects. Open the settings interface with Ctrl+, and search for options such as font size, word wrapping, autosave, minimap, and terminal behaviour. A useful starting point is enabling autosave after a short delay, especially when editing configuration files or long Markdown documents.

You can also edit settings as JSON when you want exact control. For example:

{
  "editor.fontSize": 14,
  "editor.wordWrap": "on",
  "files.autoSave": "afterDelay",
  "files.autoSaveDelay": 1000,
  "terminal.integrated.defaultProfile.linux": "bash"
}

A dark theme may be comfortable in a dim room, while a light theme can be clearer in bright Australian daylight. On a laptop used in a Sydney café or a shared office in Adelaide, reducing the minimap and increasing font size can make the workspace easier to read. Settings Sync can carry preferences between devices, but review what is being synchronised before enabling it on a shared computer.

Workspace settings belong in the project’s .vscode directory. This is useful for formatters, debugging profiles, and recommended extensions, but avoid committing personal paths or secrets. Passwords, API keys, and cloud credentials should never be placed in source files or settings committed to a public repository.

Running and debugging code

VS Code can run many programs through the integrated terminal, but the editor does not replace the language runtime. For example, installing the Python extension does not install Python itself. Likewise, a Java project needs a Java Development Kit, and a Node.js project needs Node.js available on the system.

The Run and Debug view helps create launch configurations for supported languages. Simple scripts can often be launched with the play button, while larger applications may need a .vscode/launch.json file. Breakpoints pause execution so you can inspect variables and follow program flow, which is particularly useful when learning or diagnosing a difficult fault.

Tasks can automate repetitive commands such as testing, building, or linting. A task configuration can run a project’s existing command without hiding the process behind an unfamiliar graphical layer. Keep commands visible and understandable, especially when working with shell scripts that modify files or install dependencies.

For web development, a browser and a local development server are usually required in addition to VS Code. Open the relevant port only when necessary, and remember that a server bound to all network interfaces may be reachable by other devices on the same home or workplace network. Local testing is generally safer when the service listens only on localhost.

Updating and troubleshooting the editor

The Snap version updates automatically in the background, while repository installations receive updates when you run the normal package maintenance commands:

sudo apt update
sudo apt upgrade

If extensions stop working after an Ubuntu or VS Code update, open the Extensions view and check for available updates. The Help > Toggle Developer Tools window can reveal extension errors, although its logs are mainly useful when a simpler restart does not solve the issue.

Performance problems often come from an extension, a very large workspace, or a project containing generated files such as build output and dependency directories. Close unused folders, disable extensions you do not need, and add large generated directories to search exclusions. On older computers common in school or home offices, these changes can make a noticeable difference.

Permission errors usually indicate that a project was created or modified as another user, often after running a command with sudo. Check ownership with ls -l, and use chown carefully to return personal project files to your account. Avoid launching VS Code with sudo; doing so can create root-owned settings and introduce unnecessary security risks.

Visual Studio Code becomes most useful when it remains a predictable part of the Ubuntu desktop rather than an overloaded collection of extensions. Choose one installation method, keep the editor and packages updated, use project folders with sensible permissions, and let Git record meaningful changes. With those habits in place, VS Code provides a clear working space for programming, documentation, configuration, and Linux administration.

The key point to remember is that installing the editor is only the first step: a clean workspace, suitable language tools, careful permissions, and a manageable set of extensions make the everyday Ubuntu experience reliable.