Navigating the Filesystem

Beginner

Overview

Everything in Linux lives under a single tree that starts at the root, written as /. Your shell always has a 'current working directory' — the folder you are in right now.

pwd prints that directory. ls lists what is inside it, and cd changes into another directory. Paths can be absolute (starting with /) or relative to where you currently are.

Two special names are handy: . means 'the current directory' and .. means 'the parent directory'. ~ is shorthand for your home directory.

Cheatsheet

pwdPrint the current working directory
ls -lahList all files with sizes in human-readable form
cd /var/logChange to an absolute path
cd ..Go up one directory
cd ~Go to your home directory
cd -Jump back to the previous directory

Try it

A safe, simulated terminal. Run the suggested commands to see typical output.

simulated terminal

Type a command and press Enter, or click a suggestion below to run it.

$

Quick quiz

1. Which command shows the directory you are currently in?

2. What does `cd ..` do?