Every bioinformatics tool — STAR, GATK, DESeq2, Snakemake — runs from the command line. Before you can use any of them, you need to move around Linux confidently. This lesson teaches you exactly that.
Everything in Linux lives in one giant tree starting at / — called the root.
Your home folder lives at /home/yourusername. You are always "inside" one folder at a time —
this is called your working directory. Think of it like standing inside a room in a building:
you can look around, walk to another room, or give someone your full address from the front door.
Absolute path — starts from / and works from anywhere.
Relative path — starts from wherever you are right now.
/ # root — the top of everything ├── home/ │ └── shajedur/ # your home folder, also written as ~ │ ├── projects/ │ └── data/ ├── etc/ # system configuration files ├── usr/ # installed programs └── tmp/ # temporary files, cleared on reboot
Press Tab to autocomplete folder and file names — and press it twice to see all options. This prevents typos and saves enormous time. Use it constantly.
Open your Ubuntu terminal now and type along. These are the commands you will use every single day as a bioinformatician.
pwd — Print Working DirectoryShows exactly where you are right now. Run this whenever you feel lost.
pwd /home/shajedur
ls — List directory contentsShows everything in your current folder. Flags change what you see and how.
ls # basic list ls -l # long format: permissions, owner, size, date ls -lh # same but sizes in KB / MB (human-readable) ls -a # show hidden files (names starting with .) ls -la # long format + hidden files combined ls -lh ~/projects # list a specific folder without going there # Example output of ls -lh total 24K drwxr-xr-x 3 shajedur shajedur 4.0K Jun 7 09:12 projects drwxr-xr-x 2 shajedur shajedur 4.0K Jun 7 08:44 data -rw-r--r-- 1 shajedur shajedur 1.2K Jun 6 17:30 notes.txt
cd — Change DirectoryMove into a different folder. This is how you walk around the filesystem tree.
cd projects # go into projects/ (relative path) cd .. # go UP one level to the parent folder cd ../.. # go up two levels at once cd ~ # go home from anywhere cd /home/shajedur/projects # absolute path — works from anywhere cd - # jump back to the previous directory
mkdir — Make DirectoryCreate new folders. The -p flag lets you create nested folders in one command.
mkdir projects # create one folder mkdir -p projects/rnaseq/data # create nested folders in one command mkdir -p ~/bash-linux-practice/scripts # create your course working directory
Linux has no recycle bin. When you delete a file with rm it is gone permanently.
Always double-check before deleting anything. We will cover rm in Lesson 2.
man ls # full manual for ls — press q to quit ls --help # quick summary of all flags which python3 # shows where a program is installed
| Command | What it does | Common flags |
|---|---|---|
| pwd | Print current working directory | — |
| ls | List files and folders | -l long · -h human sizes · -a hidden |
| cd [path] | Move into a directory | .. up · ~ home · - previous |
| mkdir [name] | Create a new directory | -p create parent dirs too |
| man [cmd] | Read the manual for a command | press q to quit |
| which [cmd] | Find where a program is installed | — |
Open your Ubuntu terminal and complete all four exercises below. Type every command yourself — do not copy-paste. Muscle memory is how you really learn the command line.
Open a fresh terminal. Find out exactly where you are. Then list everything in your home folder in long format with human-readable file sizes.
💬 Hint: two commands, one after the other.
pwd /home/shajedur ls -lh ~ total 8.0K drwxr-xr-x 2 shajedur shajedur 4.0K Jun 7 09:00 Desktop drwxr-xr-x 2 shajedur shajedur 4.0K Jun 7 09:00 Documents
Create the following folder structure in a single command:
~/bash-linux-practice/scripts.
Then navigate into it and confirm you are there.
💬 Hint: use mkdir -p to create nested folders in one shot.
mkdir -p ~/bash-linux-practice/scripts cd ~/bash-linux-practice/scripts pwd /home/shajedur/bash-linux-practice/scripts
While inside scripts/, navigate up two levels with a single cd command.
Where does that put you? Confirm with pwd.
cd ../.. pwd /home/shajedur # Two levels up puts you back at your home directory
Without navigating away from your home directory, list all files including hidden ones inside /etc.
How many items can you see?
💬 Hint: ls accepts a path as an argument — you do not need to cd there first.
ls -la /etc # -l = long format, -a = all including hidden files # You will see system config files: passwd, hosts, fstab, etc.