How to install VS Code in Linux Mint using terminal?

Visual Studio Code, also known as VS Code, is a widely-used source code editor developed by Microsoft. It offers powerful features such as syntax highlighting, debugging, an integrated terminal, and a vast collection of extensions. Installing VS Code on Linux Mint via the terminal is straightforward and ensures that you always get the latest stable updates directly from Microsoft. In this guide, we will walk you through the step-by-step process of installing VS Code using the terminal. This method is recommended for users who prefer managing software through the command line for precision and efficiency.

Why Install Using the Terminal?

Installing VS Code via the terminal in Linux Mint offers several advantages:

  • Efficient automation – Ideal for users who work with scripts or multiple installations.
  • Up-to-date versions – Fetch the latest stable release directly from Microsoft’s repository.
  • Better error tracking – Terminal output helps identify and resolve installation issues.

Step 1: Update Your System

Before installing new packages, it’s good practice to ensure your system’s package index is up to date. Open your terminal and enter the following command:

sudo apt update && sudo apt upgrade -y

This command updates the package lists and upgrades existing packages. It’s particularly helpful in avoiding conflicts with outdated dependencies.

Step 2: Install Required Dependencies

To add Microsoft’s repository, you need to install the necessary tools. Run:

sudo apt install wget gpg -y

Wget allows you to download files from the internet, and GPG is used to verify signature integrity for added security.

Step 3: Import the Microsoft GPG Key

GPG keys enable your operating system to verify the authenticity of packages from external repositories. Use the command below to import the Microsoft GPG key:

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /usr/share/keyrings/packages.microsoft.gpg > /dev/null

This step ensures that the packages you install come from a trusted source.

Step 4: Enable the VS Code Repository

Now, let’s add the Visual Studio Code repository to your system’s source list using:

echo "deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" | sudo tee /etc/apt/sources.list.d/vscode.list

This tells Linux Mint where to look for the VS Code packages during installation.

Step 5: Update Repositories and Install VS Code

After adding the new repository, update the packages list again to include the new resources:

sudo apt update

Then proceed to install Visual Studio Code:

sudo apt install code

This method ensures that you are installing the official version of VS Code with automatic access to future updates via the package manager.

Step 6: Launching VS Code

Once installation is complete, you can launch VS Code by typing:

code

Alternatively, you can use your application menu to search for and open “Visual Studio Code”.

Troubleshooting Tips

If you encounter issues during installation, consider the following tips:

  • Check network connection: Internet access is required to download packages and keys.
  • Verify repository addition: Ensure the repository was added correctly without typos.
  • Reinstall dependencies: Use sudo apt install --reinstall wget gpg if tools don’t work properly.

Keeping VS Code Updated

One of the major benefits of using the terminal installation method is automatic updates. Each time you run:

sudo apt update && sudo apt upgrade

VS Code will also be checked for the latest available version.

Final Thoughts

Installing Visual Studio Code using the terminal in Linux Mint ensures a secure, streamlined, and up-to-date setup for developers. This method not only gives you full control over the installation process but also integrates VS Code into your system in a manner compliant with modern Linux standards. Whether you’re a newcomer or an experienced coder, using the terminal to install core development tools like VS Code is a skill worth mastering.

By following the steps outlined above, you’ll be equipped with a robust and versatile code editor, ready to boost your productivity on Linux Mint.

Thanks for Reading

Enjoyed this post? Share it with your networks.