Basic Bash training

Beginner Friendly · No Coding Needed

Basic Bash Training

The command line looks intimidating until you realise it’s just typing sentences a computer understands. Learn the handful of commands that unlock everything else — including bioinformatics tools.

pwd ls cd mkdir cat & more
What is “bash”? It’s a program called a shell — a text-based way to talk to your computer, by typing commands instead of clicking icons. It looks old-fashioned, but it’s how almost every scientific and bioinformatics tool actually gets run. This page includes a real, safe practice terminal — nothing you type here can break anything.
00

Getting a Real Terminal

Setup

The practice terminal further down is great for learning the commands, but eventually you’ll want a real one open on your own computer. Pick your operating system below.

Windows — via WSL

Windows doesn’t ship with a proper bash terminal, so you’ll use WSL (Windows Subsystem for Linux) — a real Linux environment that runs alongside Windows. This is what our bioinformatics training assumes too.

TIP From now on, just type wsl into PowerShell any time, or open “Ubuntu” from the Start menu, to get back to your terminal.

Mac — Terminal.app

macOS has a real terminal built in already — no installation needed.

TIP Drag the Terminal icon into your Dock once it’s open, so it’s one click away from now on.

Linux — your desktop’s terminal app

Every Linux desktop ships with a terminal app already — the exact name depends on your desktop environment.

01

The Terminal Window

Concept

When you open a terminal, you’ll see something like this, called a prompt. It’s waiting for you to type a command and press Enter.

trainee@yourcomputer:~$ _

Everything you do lives inside folders (called directories in bash-speak), just like Finder or File Explorer — except you navigate them by typing, not clicking.

02

Where Am I? Where Can I Go?

pwd · ls · cd

Three commands answer almost every “where am I” question:

# Print Working Directory — shows exactly where you are
pwd

# LiSt — shows what's inside the current folder
ls

# Change Directory — move into a folder
cd reads
TIP cd .. moves you up one folder. cd ~ or just cd takes you straight home.
03

Making Things

mkdir · touch · cp · mv · rm

Once you can move around, you’ll want to create, copy, and clean up:

# MaKe DIRectory — create a new folder
mkdir results

# create an empty file
touch notes.txt

# CoPy a file
cp genome.fasta results/genome_backup.fasta

# MoVe (or rename) a file
mv notes.txt results/notes.txt

# ReMove — careful, this doesn't go to a Recycle Bin!
rm old_file.txt
TIP rm is permanent. There’s no undo, so always double-check what you’re about to delete with ls first.
04

Looking Inside Files

cat · echo · >

cat prints a file’s contents straight to the screen — great for a quick peek at something small:

cat notes.txt

echo prints text back at you — and combined with >, it can write that text into a file:

# prints to the screen
echo "Phages are viruses that infect bacteria"

# the > sends the output into a file instead of the screen
echo "Phages are viruses that infect bacteria" > notes.txt
TIP > overwrites a file. >> (two of them) adds to the end without erasing what’s already there.
05

Shortcuts & Superpowers

Tab · * · | · –help

A few habits that make the terminal dramatically faster and friendlier:

# press Tab while typing a name — it auto-completes it for you
cd rea[Tab]

# * is a wildcard — matches anything
ls *.fastq

# | (pipe) sends one command's output into another
cat notes.txt | grep phage

# almost every tool will explain itself if you ask
ls --help
TIP Stuck on a command that’s running forever? Ctrl + C almost always cancels it safely.
06

Practice Terminal

Try it yourself

This is a real, working (simulated) terminal — type into it below. You start in a home folder with a few sample phage files already inside. Type help to see everything it understands.

trainee@thephage — bash
trainee@thephage:~$

Try: lscd readslscat phage_notes.txtcd ..

07

Quick Check

Self-test
Which command shows you what folder you’re currently in?
You want to go back up one folder. What do you type?
Which command permanently deletes a file, with no Recycle Bin to rescue it?

Cheat Sheet

CommandDoes
pwdPrint the current folder path
lsList what’s in the current folder
cd <folder>Move into a folder (cd .. to go up, cd ~ for home)
mkdir <name>Create a new folder
touch <name>Create a new empty file
cat <file>Print a file’s contents to the screen
echo "text" > fileWrite text into a file (overwrites)
cp <src> <dest>Copy a file
mv <src> <dest>Move or rename a file
rm <file>Delete a file — permanently
clearClear the terminal screen
man <command>Open the manual for a command
--helpAdd to almost any command for quick usage info