Learn to Code
All tracks
Learn to Code

Free lessons from scratch to pro — every language, databases and DevOps.

AboutContactPrivacy PolicyTerms of Use

Your progress is saved in this browser. © 2026 Learn to Code

>_
Terminal & Command Line
0/10 completed
Beginner
What is the terminal?Navigating foldersWorking with files and foldersViewing files
Intermediate
Wildcards and finding filesPipes and redirectionText processing: grep, sort, cut and friends
Advanced
Environment variables and PATHPermissions and processes
Pro
Shell productivity: aliases, scripts and dotfiles
Tracks / Terminal & Command Line / Beginner

Navigating folders

Your computer's files are organised as a tree of folders (also called directories). Moving around that tree confidently is the first real terminal skill.

The file system tree

/                       ← the root: the top of everything
├── home/
│   └── you/            ← your home folder, also written ~
│       ├── Documents/
│       ├── Downloads/
│       ├── projects/
│       │   ├── website/
│       │   └── scripts/
│       └── data/
├── etc/                ← system configuration
├── tmp/                ← temporary files
└── usr/                ← installed programs

(On macOS, home is /Users/you. On Windows with WSL, it's /home/you.)

Where am I? What's here?

Linux terminal (simulator) · editable
Command Shows
ls Files and folders here
ls folder Contents of another folder
ls -l Long format: permissions, size, date
ls -a All, including hidden files (names starting with ., like .bashrc)
ls -lh Long format with human-readable sizes (K, M, G)
tree A visual tree (often needs installing on real machines)

Moving with cd

cd means change directory.

Linux terminal (simulator) · editable
Command Goes to
cd folder A folder inside the current one
cd .. Up one level (the parent folder)
cd ../.. Up two levels
cd ~ or just cd Your home folder
cd - Back to the previous folder (toggle)
cd / The root of the file system

Notice how the prompt changes to show where you are: you@learn:~/projects/website$.

Absolute vs relative paths

A path is an address of a file or folder.

  • Absolute paths start from the root /, and they work from anywhere: /home/you/projects/website
  • Relative paths start from where you are now: projects/website, ../data
Linux terminal (simulator) · editable
Symbol Means
/ at the start The root
~ Your home folder
. The current folder
.. The parent folder

Tip: paths with spaces need quotes, cd "My Documents", or escaping, cd My\ Documents. That's why developers usually avoid spaces in file names and use my-documents.

See the whole tree

Linux terminal (simulator) · editable

Practice: treasure hunt 🗺️

Using only cd, ls and pwd:

  1. Start in your home folder. Go into projects/website and list the files.
  2. Without going home first, go to the data folder using a relative path (hint: ../..).
  3. Jump back to website with cd -.
  4. Go to /etc with an absolute path and look at what's there. What's inside os-release? (Try cat os-release.)
Linux terminal (simulator) · editable
✎ Check your understanding

1.You're in /home/you/projects/website. Where does cd .. take you?

2.Which is an absolute path?

← What is the terminal?