Skip to content

s2paik/vscode-beginner-guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

VS Code Beginner Guide for Scientists

A practical guide for wet lab scientists and researchers who need to use VS Code for the first time. Covers installation, setup, essential shortcuts, and integration with WSL (Windows Subsystem for Linux) for running bioinformatics tools.

Written from the perspective of someone who learned these tools from scratch while building a genomics analysis workflow.


Table of Contents

Section Topic
1 What is VS Code and why use it
2 Download and install
3 The VS Code interface - what everything is
4 Essential keyboard shortcuts
5 The terminal - your command line inside VS Code
6 Installing extensions
7 Setting up WSL (Windows Subsystem for Linux)
8 Connecting VS Code to WSL
9 Setting up Python in VS Code
10 Using Jupyter notebooks in VS Code
11 Git and GitHub from VS Code
12 Common problems and fixes

1. What is VS Code and why use it

VS Code (Visual Studio Code) is a free code editor made by Microsoft. Think of it as a very advanced text editor - like Notepad, but with superpowers:

  • It can run a terminal (command line) inside it, so you do not need a separate PowerShell or Terminal window
  • It highlights code with colors so it is easier to read
  • It can connect to WSL so you run Linux commands on a Windows computer
  • It has extensions (plugins) for almost everything - Python, Jupyter notebooks, Git integration, remote servers
  • It has built-in file browsing so you can see your project folders on the left side

You do NOT need to be a programmer to use VS Code. Many researchers use it simply as a better way to edit scripts, run terminal commands, and manage files.


2. Download and install

Windows

  1. Go to https://code.visualstudio.com/
  2. Click the big blue Download button
  3. Run the installer (.exe file)
  4. During installation, check these boxes:
    • Add "Open with Code" action to Windows Explorer file context menu
    • Add "Open with Code" action to Windows Explorer directory context menu
    • Add to PATH (important - lets you type "code" in terminal to open VS Code)
  5. Click Install, then Finish

Mac

  1. Go to https://code.visualstudio.com/
  2. Download the .zip file
  3. Extract it and drag Visual Studio Code.app to your Applications folder
  4. Open VS Code, then press Cmd+Shift+P, type "shell command", and select "Install 'code' command in PATH"

Linux

sudo apt update
sudo apt install code

Or download the .deb package from the website and install with:

sudo dpkg -i code_*.deb

3. The VS Code interface - what everything is

When you first open VS Code, here is what you see:

+----------------------------------------------------------+
| Menu Bar (File, Edit, View, Go, Run, Terminal, Help)      |
+------+---------------------------------------------------+
|      |                                                    |
| Side | Editor Area                                        |
| Bar  | (where you edit files)                             |
|      |                                                    |
| Icons|                                                    |
| for: |                                                    |
| Files|                                                    |
| Search                                                    |
| Git  |                                                    |
| Ext. |                                                    |
|      +---------------------------------------------------+
|      | Terminal / Output Panel                             |
|      | (command line lives here)                           |
+------+---------------------------------------------------+
| Status Bar (bottom) - shows current file, language, etc.  |
+----------------------------------------------------------+

The side bar icons (left edge)

From top to bottom:

Icon Name What it does Shortcut
Files icon Explorer Browse files and folders in your project Ctrl+Shift+E
Magnifying glass Search Search across all files in your project Ctrl+Shift+F
Branch icon Source Control Git integration (commit, push, pull) Ctrl+Shift+G
Play/bug icon Run and Debug Run scripts with debugging Ctrl+Shift+D
Blocks icon Extensions Install plugins and add-ons Ctrl+Shift+X

The bottom status bar

Shows useful information about your current state:

  • Left side: current Git branch, errors/warnings count
  • Right side: line number, file encoding, language mode
  • If connected to WSL: shows "WSL: Ubuntu" on the far left

4. Essential keyboard shortcuts

These are the shortcuts you will actually use every day. You do not need to memorize all of them - start with the top 5 and add more as you get comfortable.

The most important shortcuts

Shortcut What it does When to use it
Ctrl + backtick Toggle terminal panel Open/close the command line
Ctrl + Shift + P Command Palette Search for ANY action in VS Code
Ctrl + S Save current file Save your work (do this often)
Ctrl + Z Undo Made a mistake, go back
Ctrl + Shift + Z Redo Went back too far, go forward

Note: "backtick" is the key above Tab, to the left of the number 1. It looks like this: ` (not to be confused with a single quote)

File operations

Shortcut What it does
Ctrl + N New file
Ctrl + O Open file
Ctrl + S Save
Ctrl + Shift + S Save As
Ctrl + W Close current tab
Ctrl + Tab Switch between open tabs

Editing text

Shortcut What it does
Ctrl + C Copy selected text (or entire line if nothing selected)
Ctrl + X Cut selected text (or entire line if nothing selected)
Ctrl + V Paste
Ctrl + A Select all text in the file
Ctrl + D Select the next occurrence of the current word
Ctrl + F Find in current file
Ctrl + H Find and replace in current file
Ctrl + / Toggle comment (adds/removes # or // at start of line)
Alt + Up/Down Move the current line up or down
Ctrl + Shift + K Delete entire line

Navigation

Shortcut What it does
Ctrl + G Go to a specific line number
Ctrl + P Quick open - search for a file by name
Ctrl + Shift + F Search across all files in the project
Ctrl + Home Go to top of file
Ctrl + End Go to bottom of file

Terminal

Shortcut What it does
Ctrl + backtick Toggle terminal panel open/closed
Ctrl + Shift + backtick Create a new terminal
Ctrl + C (in terminal) Cancel/stop current running command

View and layout

Shortcut What it does
Ctrl + B Toggle side bar visibility
Ctrl + Shift + E Show file explorer in side bar
Ctrl + Shift + X Show extensions in side bar
Ctrl + + Zoom in (make text bigger)
Ctrl + - Zoom out (make text smaller)
Ctrl + 0 Reset zoom to default

5. The terminal - your command line inside VS Code

The terminal is a command line that runs inside VS Code. Instead of opening a separate PowerShell or Terminal window, you can run commands directly inside VS Code.

Opening the terminal

Press Ctrl + backtick (the key above Tab). A panel opens at the bottom of VS Code showing a command prompt.

Which shell is it running?

By default:

  • On Windows: PowerShell
  • On Mac: zsh or bash
  • On Linux: bash

You can change this. Look at the top right of the terminal panel for a dropdown arrow next to the + icon. Click it to see available shells:

  • PowerShell
  • Command Prompt (cmd)
  • Git Bash
  • Ubuntu (WSL) - if WSL is installed

Running commands

Type a command and press Enter. Examples:

pwd                    # Print working directory (where am I?)
ls                     # List files in current directory
cd ~/my-project        # Change directory
python3 my_script.py   # Run a Python script
git status             # Check Git status

Multiple terminals

Click the + icon in the terminal panel to open additional terminals. Each one is independent - you can have one running a script while typing commands in another. Use the dropdown to switch between them.

Stopping a command

If a command is running and you want to stop it, press Ctrl+C in the terminal. This sends a "cancel" signal. The cursor will blink and you might need to press it twice for some programs.


6. Installing extensions

Extensions add features to VS Code. They are like apps for your editor.

How to install

  1. Press Ctrl + Shift + X to open the Extensions panel
  2. Type the name of the extension in the search box
  3. Click Install on the one you want

Essential extensions for scientists

Extension What it does Why you need it
Python Python language support Syntax highlighting, code completion, debugging
Jupyter Jupyter notebook support Run .ipynb notebooks inside VS Code
WSL Windows Subsystem for Linux Connect VS Code to Ubuntu/Linux on Windows
Pylance Python IntelliSense Better autocomplete and error detection for Python
GitLens Enhanced Git integration See who changed what and when in your code
Markdown Preview Preview .md files See how your README will look on GitHub

How to install all essential extensions at once

Open the terminal (Ctrl + backtick) and paste:

code --install-extension ms-python.python
code --install-extension ms-toolsai.jupyter
code --install-extension ms-vscode-remote.remote-wsl
code --install-extension ms-python.vscode-pylance
code --install-extension eamodio.gitlens
code --install-extension shd101wyy.markdown-preview-enhanced

Each line installs one extension. "code" is the VS Code command-line tool, and "--install-extension" tells it to install a specific extension by its unique identifier.


7. Setting up WSL (Windows Subsystem for Linux)

WSL lets you run a full Linux environment on your Windows computer. This is important because many bioinformatics tools (samtools, bedtools, grep, sed) only work on Linux.

Why not just use PowerShell?

PowerShell is Windows' command line. It uses different commands and syntax from Linux. Most bioinformatics tutorials and tools are written for Linux/Mac. WSL gives you a real Linux terminal without needing a separate computer.

Task PowerShell (Windows) Bash (Linux/WSL)
List files dir ls
Change directory cd cd
Show file contents type filename cat filename
Search in files Select-String grep
Download a file Invoke-WebRequest wget or curl
Find and replace (complex) sed

Installing WSL

Open PowerShell as Administrator:

  1. Press Windows key
  2. Type PowerShell
  3. Right-click Windows PowerShell
  4. Select Run as administrator

Then type:

wsl --install

This installs WSL and Ubuntu automatically. Your computer will need to restart after installation.

First-time setup after restart

After restarting, Ubuntu will launch automatically and ask you to:

  1. Create a username (can be anything, e.g. your first name)
  2. Create a password (characters will NOT appear as you type - this is normal Linux security behavior, not a bug)
  3. Confirm the password

You will then see a prompt like:

username@COMPUTERNAME:~$

This means you are now in a Linux terminal. You can type Linux commands here.

Important: your Windows files in WSL

Your Windows C: drive is accessible in WSL at /mnt/c/

So your Downloads folder is:

/mnt/c/Users/YOUR_USERNAME/Downloads/

And your Desktop is:

/mnt/c/Users/YOUR_USERNAME/Desktop/

8. Connecting VS Code to WSL

Once WSL is installed, you can run VS Code connected to your Linux environment. This means the terminal inside VS Code runs bash (Linux) instead of PowerShell (Windows).

First time setup

  1. Open VS Code
  2. Press Ctrl + Shift + X and install the WSL extension (search "WSL")
  3. Press Ctrl + Shift + P to open Command Palette
  4. Type: WSL: New WSL Window
  5. Press Enter

A new VS Code window opens. The bottom-left corner shows WSL: Ubuntu in blue/green. This means VS Code is now connected to your Linux environment.

The first time you do this, it takes several minutes because VS Code is installing its server component inside WSL. Every time after that, it opens in seconds.

Opening the terminal in WSL mode

Once connected to WSL, press Ctrl + backtick to open the terminal. It will automatically be a bash (Linux) terminal, not PowerShell.

You can verify by typing:

echo $SHELL

It should show /bin/bash (not PowerShell).

If the terminal opens as PowerShell instead of bash

Sometimes VS Code opens PowerShell even in WSL mode. To switch:

  1. Look at the top-right of the terminal panel
  2. Click the dropdown arrow next to the + icon
  3. Select Ubuntu or WSL

Or just type wsl in the PowerShell terminal and press Enter.

Shutting down WSL

WSL shuts down automatically after a few minutes of inactivity. To manually shut it down, open PowerShell (not WSL) and type:

wsl --shutdown

9. Setting up Python in VS Code

Check if Python is installed

In the terminal:

python3 --version

If it shows a version number (e.g. Python 3.11.0), Python is installed. If it says "command not found", install it:

On WSL/Ubuntu:

sudo apt update
sudo apt install python3 python3-pip python3-venv -y

On Windows (without WSL):

Download from https://www.python.org/downloads/ and run the installer. Make sure to check "Add Python to PATH" during installation.

Setting up a virtual environment

A virtual environment is an isolated space where you install Python packages without affecting the rest of your system. Think of it as a clean, separate toolbox for each project.

Create one:

python3 -m venv ~/myenv

The ~ means your home directory. "myenv" is the name (you can call it anything: bioenv, analysis-env, etc.)

Activate it:

source ~/myenv/bin/activate

You will see (myenv) appear at the start of your terminal prompt. This means the environment is active.

Install packages inside it:

pip install pandas numpy matplotlib seaborn scipy

Deactivate when done:

deactivate

Important: activate every time

Every time you open a new terminal, the virtual environment is NOT active by default. You must run the source command again:

source ~/myenv/bin/activate

You will know it is active when you see (myenv) at the start of your prompt.

If pip gives "externally-managed-environment" error

Newer versions of Ubuntu block system-wide pip installs. This is why virtual environments are required. If you see this error, create a venv first (steps above), activate it, then pip install inside it.


10. Using Jupyter notebooks in VS Code

Jupyter notebooks (.ipynb files) let you run code in small chunks (cells) and see results immediately below each chunk. They are popular in data science and bioinformatics because you can mix code, output, and notes in one document.

Setup

  1. Install the Jupyter extension: Ctrl + Shift + X, search "Jupyter", click Install
  2. Make sure Python is set up (Section 9)

Creating a new notebook

  1. Press Ctrl + Shift + P
  2. Type: Jupyter: Create New Jupyter Notebook
  3. Press Enter

A new notebook opens with an empty code cell.

Using notebooks

Action How to do it
Run a cell Click the play button on the left of the cell, or press Shift+Enter
Add a cell below Click + Code or + Markdown above the notebook
Delete a cell Click the trash can icon on the cell toolbar
Move a cell Click and drag the cell handle on the left
Switch cell type Click Code or Markdown in the cell toolbar
Select kernel Click "Select Kernel" in the top right (choose your Python/venv)

Selecting the right kernel

The kernel is which Python installation the notebook uses. Click "Select Kernel" in the top-right corner and choose:

  • Your virtual environment (e.g. myenv) if you created one
  • Python 3.x.x if using system Python

If your packages are installed in a venv but the notebook says "ModuleNotFoundError", you probably selected the wrong kernel.

Code cells vs Markdown cells

  • Code cells: run Python code, show output below
  • Markdown cells: write formatted text (headers, bullets, links) Click the cell type toggle to switch between them

11. Git and GitHub from VS Code

Git tracks changes to your files. GitHub stores your Git repository online so others can see and download it.

What each command does

Command Plain English
git add . Select all changed files for the next snapshot
git commit -m "message" Take a snapshot with a description
git push Upload the snapshot to GitHub
git pull Download changes from GitHub to your computer
git status Show which files have changed since last snapshot
git clone URL Download a repository from GitHub to your computer

First-time Git setup

Tell Git who you are (run once, ever):

git config --global user.name "your-github-username"
git config --global user.email "your-email@example.com"

Creating a new repository

  1. Create the repo on GitHub (github.com > + icon > New repository)

  2. Clone it to your computer:

    git clone https://github.com/YOUR_USERNAME/YOUR_REPO.git cd YOUR_REPO

  3. Make changes (create/edit files)

  4. Push changes:

    git add . git commit -m "Describe what you changed" git push

GitHub authentication

GitHub no longer accepts passwords for git push. You need a Personal Access Token:

  1. Go to github.com > your profile icon > Settings
  2. Scroll down to Developer settings (bottom of left sidebar)
  3. Personal access tokens > Tokens (classic)
  4. Generate new token (classic)
  5. Name it (e.g. "wsl-access"), set expiration, check "repo" scope
  6. Click Generate token
  7. COPY THE TOKEN IMMEDIATELY (starts with ghp_)
  8. You will never see it again after leaving the page

When git push asks for your password, paste this token instead.

VS Code terminal and Git authentication

If you get ECONNREFUSED errors when pushing from VS Code terminal, run these three lines before git push:

unset GIT_ASKPASS
unset VSCODE_GIT_ASKPASS_MAIN
unset VSCODE_GIT_ASKPASS_NODE

This stops VS Code from intercepting the Git authentication and lets you type your username and token directly in the terminal. You need to run these three lines every time you open a new terminal in VS Code.


12. Common problems and fixes

Problem Symptom Fix
source not recognized "source is not recognized as a cmdlet" You are in PowerShell, not bash. Type wsl first, or switch terminal to Ubuntu
python not found "command not found" in WSL Use python3 instead of python
pip externally managed "externally-managed-environment" error Create a venv first, activate it, then pip install inside it
WSL takes forever to start First launch hangs for 10+ minutes Normal for first time. If truly stuck, restart computer and try again
Git push fails ECONNREFUSED socket error Run the three unset commands before git push
Git push rejected "Updates were rejected" Run git pull first, then git push
Ctrl+backtick does nothing Terminal does not open Try View menu > Terminal, or Ctrl+Shift+backtick
Wrong Python selected ModuleNotFoundError despite installing Select the correct kernel/interpreter (your venv, not system Python)
File permission denied Cannot read or write a file File may be open in another program (IGV, Excel). Close it first.
nano editor confusion Cannot figure out how to save/exit Ctrl+O then Enter to save. Ctrl+X to exit.
WSL cannot find Windows files Path errors Windows C: drive is at /mnt/c/ in WSL. Downloads is /mnt/c/Users/YOUR_NAME/Downloads/
VS Code not connecting to WSL "Opening Remote..." hangs forever Close VS Code, run wsl --shutdown in PowerShell, restart VS Code

Quick reference card

Print this page and keep it next to your computer:

ESSENTIAL SHORTCUTS
Ctrl + backtick        Open/close terminal
Ctrl + Shift + P       Command Palette (search any action)
Ctrl + S               Save
Ctrl + Z               Undo
Ctrl + Shift + Z       Redo
Ctrl + F               Find in file
Ctrl + Shift + F       Find in all files
Ctrl + /               Comment/uncomment line
Ctrl + B               Toggle side bar

TERMINAL COMMANDS (bash/WSL)
cd FOLDER              Change directory
ls                     List files
pwd                    Print current directory
cat FILE               Show file contents
cp SOURCE DEST         Copy a file
mv SOURCE DEST         Move or rename a file
mkdir FOLDER           Create a new folder
rm FILE                Delete a file (careful - no recycle bin)
grep PATTERN FILE      Search for text in a file
python3 SCRIPT.py      Run a Python script
source ~/env/bin/activate   Activate virtual environment

GIT COMMANDS
git status             What has changed?
git add .              Stage all changes
git commit -m "msg"    Snapshot with description
git push               Upload to GitHub
git pull               Download from GitHub
git clone URL          Download a repository

About

This guide was written by a wet lab scientist who learned VS Code while building a genomics analysis workflow. Every problem listed in the troubleshooting section was encountered firsthand. The goal is to save other researchers the hours of confusion that come with setting up computational tools for the first time.

Related repository: geo-igv-protocol - Beginner-friendly workflows for GEO data analysis and IGV visualization.

About

Practical VS Code setup guide for wet lab scientists and researchers

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors