How to Run Visual Studio Code on Linux?

9 minutes read

Visual Studio Code is a lightweight and versatile source code editor developed by Microsoft. Although originally designed for Windows, it is possible to run Visual Studio Code on Linux systems as well. Here are the steps to run Visual Studio Code on Linux:

  1. Download the Visual Studio Code package for Linux from the official website. It is available in .deb and .rpm formats to support various Linux distributions.
  2. Once the package is downloaded, open the terminal and navigate to the directory where you downloaded the package.
  3. Extract the contents of the package using the appropriate command. For .deb packages, use dpkg -i .deb, and for .rpm packages, use rpm -i .rpm. Replace with the actual name of the downloaded package.
  4. After the installation is complete, you can launch Visual Studio Code from the system's application menu or by running the command code in the terminal.
  5. Upon launching, Visual Studio Code will open with a minimalistic interface. You can start using it to write, edit, and debug code using a wide range of programming languages.
  6. Additionally, Visual Studio Code provides a rich array of extensions that enhance its functionality. You can find and install extensions from the Visual Studio Code marketplace to tailor the editor to your specific needs.


Note that Visual Studio Code might have additional requirements or dependencies based on your Linux distribution. In case of any issues, refer to the official documentation or community forums for assistance.

Best Linux Books to Read in 2024

1
Linux Bible

Rating is 5 out of 5

Linux Bible

2
CompTIA Linux+ Certification All-in-One Exam Guide, Second Edition (Exam XK0-005)

Rating is 4.9 out of 5

CompTIA Linux+ Certification All-in-One Exam Guide, Second Edition (Exam XK0-005)

3
How Linux Works, 3rd Edition: What Every Superuser Should Know

Rating is 4.8 out of 5

How Linux Works, 3rd Edition: What Every Superuser Should Know

4
CompTIA Linux+ Study Guide: Exam XK0-005

Rating is 4.7 out of 5

CompTIA Linux+ Study Guide: Exam XK0-005

5
Linux All-In-One For Dummies (For Dummies (Computer/Tech))

Rating is 4.6 out of 5

Linux All-In-One For Dummies (For Dummies (Computer/Tech))

6
The Linux Command Line, 2nd Edition: A Complete Introduction

Rating is 4.5 out of 5

The Linux Command Line, 2nd Edition: A Complete Introduction

7
Linux Basics for Hackers: Getting Started with Networking, Scripting, and Security in Kali

Rating is 4.4 out of 5

Linux Basics for Hackers: Getting Started with Networking, Scripting, and Security in Kali


How to change the default terminal in Visual Studio Code on Linux?

To change the default terminal in Visual Studio Code on Linux, follow these steps:

  1. Open Visual Studio Code.
  2. Click on the menu icon (three horizontal lines) in the top left corner of the window.
  3. Select "Preferences" from the dropdown menu.
  4. Click on "Settings" to open the settings JSON file.
  5. In the search bar at the top of the settings window, type "terminal".
  6. Scroll down to the "Terminal > Integrated > Linux Exec" section.
  7. By default, this setting is set to "xterm.termnial". You can change it to another terminal of your choice. For example, for GNOME Terminal, change it to "gnome-terminal" or for Konsole, change it to "konsole". Make sure to provide the correct terminal executable name.
  8. You can also specify additional arguments by modifying the value of "terminal.integrated.linuxArgs".
  9. Save the settings JSON file by clicking on the "Save" icon in the top right corner (or by pressing Ctrl + S).


Now, whenever you open the integrated terminal in Visual Studio Code, it should use your newly set default terminal.


How to open a project in Visual Studio Code on Linux?

To open a project in Visual Studio Code on Linux, you can follow these steps:

  1. Open Visual Studio Code: You can either search for it in the application launcher or open a terminal and type code.
  2. Click on "File" in the top menu bar.
  3. Select "Open Folder" from the drop-down menu.
  4. Browse for the folder where your project is located and click on "Open". Alternatively, you can type the path to the project folder directly in the address bar at the top.


Once you've completed these steps, Visual Studio Code will open the project, and you can start working on it.


How to install Visual Studio Code on Linux?

To install Visual Studio Code on Linux, you can follow these steps:

  1. Open a terminal window.
  2. Update the package manager's cache by running the following command:
1
sudo apt update


  1. Import the Microsoft GPG key to ensure package integrity with the following command:
1
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EB3E94ADBE1229CF


  1. Add the Visual Studio Code repository to the system by running the command that corresponds to your Linux distribution:


For Ubuntu and its derivatives (such as Linux Mint):

1
echo "deb [arch=amd64] http://packages.microsoft.com/repos/vscode stable main" | sudo tee /etc/apt/sources.list.d/vscode.list


For Debian:

1
echo "deb [arch=amd64] http://packages.microsoft.com/repos/vscode stable main" | sudo tee /etc/apt/sources.list.d/vscode.list


For Fedora and CentOS/RHEL:

1
2
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'


  1. Update the package manager's cache again by running:
1
sudo apt update


  1. Finally, install Visual Studio Code by running the following command:
1
sudo apt install code


Once the installation is complete, you can launch Visual Studio Code by searching for it in the applications menu or by running code in the terminal.


How to install the Python extension in Visual Studio Code on Linux?

To install the Python extension in Visual Studio Code on Linux, follow these steps:

  1. Open Visual Studio Code and click on the "Extensions" icon in the sidebar (or press Ctrl + Shift + X).
  2. In the search bar, type "Python" and look for the official Python extension by Microsoft.
  3. Click on the "Install" button next to the extension. It may take a moment to download and install.
  4. After installation, you should see an option to "Reload" or "Enable" the extension. Click on it to enable the Python extension in Visual Studio Code.
  5. Additionally, you may need to install Python on your Linux machine if it's not already installed. You can check if Python is installed by opening a terminal and typing python3 --version. If it's not installed, you can typically install it using your distribution's package manager. For example, on Ubuntu or Debian, you can run sudo apt-get install python3 in the terminal.
  6. Once Python is installed, you can verify that the extension is working by opening a Python file (.py) in Visual Studio Code. You should see syntax highlighting, code completion, and other features specific to Python.


Note: The above instructions assume you are using Visual Studio Code on a Linux distribution like Ubuntu. The steps may be slightly different for other distributions, but the general process remains the same.

Facebook Twitter LinkedIn Whatsapp Pocket

Related Posts:

To create a simple Flutter app with Dart, follow these steps:Install Flutter SDK: First, download and install Flutter SDK from the official Flutter website according to your operating system (Windows, macOS, or Linux). Set up your IDE: Flutter works with vario...
Moving Averages (MA) in Visual Basic are a commonly used technical analysis tool for smoothing out price data in a time series. The moving average is calculated by taking the average price of a security over a specified period of time, such as 10 days or 50 da...
Parsing a JSON file in Kotlin on Android Studio involves several steps. Here's a simplified explanation:First, make sure to have the necessary dependencies. Add the implementation 'org.json:json:20210307' line to your build.gradle file. Create a JS...