From Bulk & scRNA-seq to Spatial Transcriptomics for Fighting Cancer – 2026
2026-09-23
Lecture 01
Course vision & Spatial Paradigm
↓
Lecture 02: Linux Environment & File System Navigation ← YOU ARE HERE
↓
Lecture 04
Core Bioinformatic CLI Tools
↓
Lecture 06
Text Stream Processing & Pipeline Automation
Download the human TP53 mRNA transcript, variant 1:
With the graphical interface, we might:
.fasta file into our project directory.This works well for one or a few sequences. But it sounds a bit cumbersome to document and reproduce, doesn’t it?
And what if we need to download dozens or hundreds of accessions?
This is where the CLI (command-line interface) comes in.
First, we create and navigate to our project folder:
Then, we can download the FASTA file using NCBI’s EFetch utility:
With the file downloaded, we can inspect its contents:
All these commands can be saved in a script file, such as scripts/tp53_download.sh, and then run with:
Bioinformatics workflows are heavily built around Unix/Linux command-line tools.
Commands such as head, cat, mv, cp, grep, awk, curl.
A GUI is useful.
The command line becomes especially useful when work involves:
| Situation | Why CLI helps |
|---|---|
| Large datasets | precise file operations |
| Repeated work | commands are repeatable |
| Remote servers / HPC | terminal access is standard |
| Reproducible workflows | commands can be documented |
| Bioinformatics software | many tools are command-line based |
Note
The point is not “GUI bad, CLI good.”
GUI is good for everyday use and graphics-related work. CLI is good for large datasets and complicated workflows.
Linux is not one operating system.
A Linux distribution (distro) combines:
| Distribution | Family | Package manager | General character |
|---|---|---|---|
| Ubuntu | Debian | apt |
Beginner-friendly, desktop + server |
| Debian | Debian | apt |
Stable, conservative, highly influential |
| Fedora | Red Hat | dnf |
Modern, community-driven, fast-moving |
| RHEL | Red Hat | dnf |
Enterprise-focused, long-term support |
| Arch Linux | Independent | pacman |
Minimal, customizable, rolling release |
| Distribution | Family | Package manager | General character |
|---|---|---|---|
| Ubuntu | Debian | apt |
Beginner-friendly, desktop + server |
| Debian | Debian | apt |
Stable, conservative, highly influential |
| Fedora | Red Hat | dnf |
Modern, community-driven, fast-moving |
| RHEL | Red Hat | dnf |
Enterprise-focused, long-term support |
| Arch Linux | Independent | pacman |
Minimal, customizable, rolling release |
Ubuntu is my primary Linux distro.
For this course, Ubuntu will be the default reference environment for demonstrations.
apt and SnapsBoth Ubuntu and Debian use the .deb package format and the apt package-management system.
Example:
Note
You will see sudo apt ... repeatedly when installing bioinformatics software and Linux utilities. It is the main way to install packages on Ubuntu.
Ubuntu is based on Debian — but it’s its own distribution.
| Debian | Ubuntu |
|---|---|
| Own releases | Own release cycle |
| Own repositories | Ubuntu repositories |
| Debian defaults | Ubuntu defaults |
| Debian community | Ubuntu + Canonical |
Ubuntu also adds its own technologies, such as Snap:
Knowing which distribution you want is only half the question.
You also need to decide how Linux will run on your computer:
A virtual machine runs another operating system inside your current operating system.
Examples of a virtual machine:
| Advantages | Disadvantages |
|---|---|
| Low risk to the host system | Consumes additional RAM and CPU |
| Linux and Windows / MacOS can run simultaneously | Requires additional storage |
| Good for experimentation | Not the full Linux experience |
A dual-boot system has two operating systems installed on the same computer.
| Advantages | Disadvantages |
|---|---|
| Linux runs directly on the hardware | Requires rebooting to switch |
| Excellent performance | Partitioning requires care |
| Full Linux desktop experience | Installation mistakes can affect existing data |
The installation process is actually quite straightforward. First, download the Ubuntu ISO image — most likely the latest LTS (long-term support) version.
Then, write the ISO image to a USB drive using an app such as Ventoy or Rufus.
Finally, boot from the USB drive to start the Ubuntu live environment, then follow the on-screen instructions to install Ubuntu alongside your existing operating system.
Warning
Make sure you have enough free disk space for Ubuntu and back up important data before modifying your partitions.
WSL2 uses a lightweight virtual-machine architecture with a real Linux kernel. It allows Linux environments to run alongside Windows, accessible through Windows Terminal. The command-line experience is similar to working with an HPC cluster via SSH.
Compared with a traditional virtual machine, WSL2 has fast startup and very low overhead. It provides close integration between Windows and Linux, allowing you to use Linux tools alongside your normal Windows applications.
Windows drives are accessible from Linux under paths such as /mnt/c/, while Linux files can also be accessed from Windows through \\wsl.localhost.
/ = filesystem rootWindows commonly uses drive letters like C: and D:
Linux presents one filesystem tree rooted at /. We often think of it as a tree with branches and leaves.
Note
As a bioinformatician, you will spend most of your time working in your $HOME directory (/home/<user>), not the filesystem root (/).
The current user’s home directory is usually written as: ~
If the username is ht2905:
Therefore ~ is a shortcut for /home/ht2905.
The exact path varies by machine.
| Symbol | Meaning |
|---|---|
/ |
filesystem root |
~ |
current user’s home |
. |
current directory |
.. |
parent directory |
Note
How did these symbols come to be?
It would be tedious and impractical if Unix/Linux users had to type out long paths every time. These symbols provide convenient shorthand for locations that users refer to frequently.
Starts at /.
Starts from where you are now.
Note
An absolute path is anchored to /.
A relative path is anchored to the current working directory.
You are here:
Then:
and:
refer to the same file.
Important
For practice exercises, see the companion Colab notebook for this lecture, available in the course Github repository.
Terminal → gives you a place to type
↓
Shell (e.g., Bash, Zsh) → interprets what you type
↓
Command / program → performs an operation
↓
Operating system + filesystem
Note
Terminal ≠ shell ≠ command
pwdPrint working directory
lsList all files and folders under a specified directory
lsUseful variants:
Compare these outputs:
cdcd: change directory.
A reliable beginner loop:
whoamiPrint the current username. Self-explanatory.
This matters especially on shared systems where:
Example:
manSimply type:
man is too verbose? Use tldrman provides detailed documentation, but sometimes you just want a few practical examples.
For that, you can use tldr. tldr is really useful, but it isn’t shipped with Ubuntu by default.
To install tldr on Ubuntu:
After that, just type:
Compare this output with that of man:
less vs. manAfter that, just type:
Compare this output with that of man:
Or:
%%bash is used to mark a cell as a Bash script. It is not a command itself.! is used to mark a line as a shell command.Warning
Colab is a temporary teaching environment.
Do not treat a runtime as permanent storage.
Think of navigation as three questions:
Where am I? → pwd
What is here? → ls
Where do I want to go? → cd
Instead of:
type:
Bash can complete filenames and directory names.
If the completion is ambiguous, press Tab twice to see matches.
A predictable project is easier to understand and automate:
Note
Why does project structure matter?
A good structure is part of reproducibility. You should be able to return to your project months or years later and immediately understand where things are and what each file or folder is for.
mkdirNested directories:
Check:
touchUpdate a file’s timestamp, or create it if it does not exist
Then:
Note
touch is fundamentally about timestamps. We use it when we want to update a file’s timestamp.
Creating an empty file is a common side effect when the file does not already exist.
cpCopy into a directory:
Copy a directory recursively:
mvMove:
Rename:
Note
mv changes the path or name.
rmAsk first:
Ask first:
Recursive removal:
Warning
rm is not the same as moving something to a graphical Trash folder like Windows Recycle Bin or macOS Trash. It is permanent.
Slow down before deleting. For a more cautious approach, use rm -i to confirm each deletion, or install trash-cli for a more conventional “move to trash” behavior.
Common text-based formats include:
catheadtaillesscat: print a fileGood for small files.
Not a good idea for:
Warning
Do not casually print huge sequencing files to the terminal.
Tip
For those familiar with coding, cat is short for “concatenate.”
head: extract the beginningExactly 20 lines:
tail: extract the endExactly 20 lines:
wc: Count lines, words, and bytesA simplified FASTQ record:
1 FASTQ record = 4 lines
So:
gives the total number of lines.
For a well-formed FASTQ file:
Example: 4,000,000 lines → 1,000,000 reads
less: Inspect without dumping everythingUseful keys:
Names beginning with . are normally hidden from plain ls.
Examples:
Compare:
with:
Human-readable sizes might look like:
wget: Download from a URLExample:
Then verify:
wget vs curlwgetCommonly used as a downloader.
curlGeneral-purpose data transfer tool.
Save using the remote filename:
This:
usually prints the response.
This:
saves the file.
rsync, where does it fit?Typical server transfer:
Conceptually:
Useful for:
Linux tracks:
A long listing might begin:
Read it as three blocks:
| Symbol | Meaning |
|---|---|
r |
read |
w |
write |
x |
execute |
- |
not granted |
Example:
means:
For a file:
For a directory:
chmodInspect:
Symbolic modes also exist:
Basic ownership syntax:
In managed servers, ownership is often controlled by administrators.
Warning
Do not run random recursive ownership commands such as chown -R ... on a system you do not fully understand.
.gz?Instead of:
you often see:
gzip compression reduces storage and transfer costs.
Note
Compression ≠ archiving
Compress:
Usually becomes:
Decompress:
Check:
tarCreate:
Extract:
Compressed archive:
Extract:
tar.gz?Note
tar.gz = archive + gzip compression
nanoEssential shortcuts:
Note
Why know it?
On a remote server, your preferred GUI editor may not be available. As a bioinformatician or data scientist, you will often work with institutional HPC clusters via SSH, where the terminal is your main interface.
vimVim is a powerful modal text editor. It can be extremely efficient, provided you can remember its many commands.
Unlike nano:
The basic workflow:
vim?A built-in interactive tutorial that teaches Vim’s core commands.
Note
Why know it?
Vim is commonly available on Linux servers and other remote environments.
You do not need to become a Vim expert to use Linux effectively. As sad and shameful as it sounds, Vim and I just don’t click :(
Useful less keys:
Remember:
Examples:
Essential nano shortcuts:
Essential Vim commands taught today: