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.
| 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 |
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.
- Go to https://code.visualstudio.com/
- Click the big blue Download button
- Run the installer (.exe file)
- 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)
- Click Install, then Finish
- Go to https://code.visualstudio.com/
- Download the .zip file
- Extract it and drag Visual Studio Code.app to your Applications folder
- Open VS Code, then press Cmd+Shift+P, type "shell command", and select "Install 'code' command in PATH"
sudo apt update
sudo apt install code
Or download the .deb package from the website and install with:
sudo dpkg -i code_*.deb
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. |
+----------------------------------------------------------+
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 |
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
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.
| 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)
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
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.
Press Ctrl + backtick (the key above Tab). A panel opens at the bottom of VS Code showing a command prompt.
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
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
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.
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.
Extensions add features to VS Code. They are like apps for your editor.
- Press Ctrl + Shift + X to open the Extensions panel
- Type the name of the extension in the search box
- Click Install on the one you want
| 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 |
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.
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.
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 |
Open PowerShell as Administrator:
- Press Windows key
- Type PowerShell
- Right-click Windows PowerShell
- Select Run as administrator
Then type:
wsl --install
This installs WSL and Ubuntu automatically. Your computer will need to restart after installation.
After restarting, Ubuntu will launch automatically and ask you to:
- Create a username (can be anything, e.g. your first name)
- Create a password (characters will NOT appear as you type - this is normal Linux security behavior, not a bug)
- 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.
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/
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).
- Open VS Code
- Press Ctrl + Shift + X and install the WSL extension (search "WSL")
- Press Ctrl + Shift + P to open Command Palette
- Type: WSL: New WSL Window
- 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.
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).
Sometimes VS Code opens PowerShell even in WSL mode. To switch:
- Look at the top-right of the terminal panel
- Click the dropdown arrow next to the + icon
- Select Ubuntu or WSL
Or just type wsl in the PowerShell terminal and press Enter.
WSL shuts down automatically after a few minutes of inactivity. To manually shut it down, open PowerShell (not WSL) and type:
wsl --shutdown
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.
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
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.
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.
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.
- Install the Jupyter extension: Ctrl + Shift + X, search "Jupyter", click Install
- Make sure Python is set up (Section 9)
- Press Ctrl + Shift + P
- Type: Jupyter: Create New Jupyter Notebook
- Press Enter
A new notebook opens with an empty code cell.
| 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) |
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: run Python code, show output below
- Markdown cells: write formatted text (headers, bullets, links) Click the cell type toggle to switch between them
Git tracks changes to your files. GitHub stores your Git repository online so others can see and download it.
| 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 |
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"
-
Create the repo on GitHub (github.com > + icon > New repository)
-
Clone it to your computer:
git clone https://github.com/YOUR_USERNAME/YOUR_REPO.git cd YOUR_REPO
-
Make changes (create/edit files)
-
Push changes:
git add . git commit -m "Describe what you changed" git push
GitHub no longer accepts passwords for git push. You need a Personal Access Token:
- Go to github.com > your profile icon > Settings
- Scroll down to Developer settings (bottom of left sidebar)
- Personal access tokens > Tokens (classic)
- Generate new token (classic)
- Name it (e.g. "wsl-access"), set expiration, check "repo" scope
- Click Generate token
- COPY THE TOKEN IMMEDIATELY (starts with ghp_)
- You will never see it again after leaving the page
When git push asks for your password, paste this token instead.
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.
| 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 |
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
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.