Skip to aside Skip to content Skip to footer

Tutorial: Use VS Code with BioShell

Visual Studio Code (VS Code) is a free code editor that can connect to your BioShell environment over SSH. Once connected, you can browse directories, edit, view and download files, and run a terminal inside BioShell from a single window on your own computer.

Before you start, you will need:

  • A BioShell environment and your connection details (your username and your BioShell IP address).
  • An SSH key pair whose public key has been shared with the BioShell team. If you have not done this yet, follow the SSH key generation tutorial first.

Step 1: Install VS Code

  1. Download VS Code by following the installation instructions for your operating system.
  2. Open VS Code to confirm it installed correctly.

    The VS Code welcome screen after a fresh install.

Step 2: Install the extensions

The Remote - SSH extension lets VS Code connect to BioShell.

  1. In the left sidebar, select the Extensions button (four blocks), or press Ctrl+Shift+X (Cmd+Shift+X on macOS).
  2. Search for remote ssh and select Remote - SSH (published by Microsoft).
  3. Select Install.
  4. Once installed, the new Remote Explorer icon will appear in the left sidebar.

    Top: (1) the Extensions button in the left sidebar; (2) search “remote ssh” (3) Install Remote - SSH. Bottom, after installing: the button changes to Disable and Uninstall, and (4) the new Remote Explorer icon appears in the left sidebar.

You can install other extensions in the same way to suit your work. For example, if you use Nextflow in BioShell, search for nextflow and install the Nextflow extension for syntax highlighting.

Step 3: Add BioShell as an SSH host

By default, VS Code reads hosts from your SSH config file (~/.ssh/config for Linux/macOS, C:\Users\<you>\.ssh\config on Windows). If you already added a bioshell entry when connecting to BioShell, skip to Step 4.

  1. Press Ctrl+Shift+P (Cmd+Shift+P on macOS) to open the Command Palette.
  2. Type remote ssh and select Remote-SSH: Open SSH Configuration File…. This may appear in a different position in the list.

    The Command Palette filtered by remote ssh. The arrow points to Remote-SSH: Open SSH Configuration File….

  3. Select your user config file (for example ~/.ssh/config on macOS and Linux, or C:\Users\<you>\.ssh\config on Windows).

    The arrow points to the config file in your own home directory (/Users/<you>/.ssh/config on macOS). Do not select the system-wide /etc/ssh/ssh_config.

  4. Add the following entry, replacing the placeholders with your connection details and the path to your private key:

    Host bioshell
        HostName <your-bioshell-ip>
        User <username>
        IdentityFile ~/.ssh/bioshell_key
    
  5. Save the file.

Step 4: Connect to BioShell

  1. Open the Command Palette (Ctrl+Shift+P, or Cmd+Shift+P on macOS).
  2. Type remote ssh and select Remote-SSH: Connect to Host…. This may appear in a different position in the list.

    The Command Palette filtered by remote ssh. The arrow points to Remote-SSH: Connect to Host….

  3. Select bioshell. A new VS Code window opens.

    The list of configured SSH hosts. The arrow points to bioshell, the host you added to your SSH config file.

When the indicator in the bottom-left corner of the window shows SSH: bioshell, you are connected. The first connection can take a minute while VS Code sets up its server component in your home directory.

The SSH: bioshell indicator in the bottom-left corner confirms you are connected to BioShell.

Step 5: Open a folder and a terminal

  1. Select the Explorer in the left sidebar (two pages icon), or press Ctrl+Shift+E (Cmd+Shift+E on macOS).
  2. Select Open Folder.
  3. Enter the folder you want to work in and select OK. Your home directory (/home/<username>/) is the default; to work with your analysis data, enter /mnt/data instead.

    (1) the Explorer icon in the left sidebar; (2) the Open Folder button in the Explorer; (3) the folder path box, here set to /mnt/data. Select OK to open it.

  4. Open a terminal inside BioShell by pressing Ctrl+` (Cmd+` on macOS), or from the menu with Terminal > New Terminal.

The folder appears in the Explorer sidebar, where you can open, edit, upload (drag and drop) and download (right-click > Download…) files. Commands typed in the terminal run in your BioShell environment, so tools and modules work exactly as they do over a plain SSH connection.

The Folder label points to the opened /mnt/data folder, shown as data [SSH: bioshell] in the Explorer sidebar. The Terminal label points to a terminal running inside BioShell, with the prompt in /mnt/data.