Moving Around: pwd, ls, cd
A free lesson from Swipe Coding · Ship It, level 1 · updated October 2026
By the Swipe team, founded by Colin · how we make lessons
Your files live in folders inside folders — this is called a directory tree, and the terminal always has you "standing" inside one folder at a time, called the current directory. Three commands let you find your way around it: pwd prints where you currently are, ls lists what's inside the current folder, and cd changes which folder you're standing in.
$ pwd /c/Users/maya $ ls Desktop Documents Downloads Pictures
To move into a folder, use cd followed by its name — this is called changing directory. To go back up one level (into the folder that contains the one you're in), use cd .. — two dots mean "the parent folder". You can chain a full path in one go too, like cd Documents/projects, instead of moving one folder at a time.
$ cd Documents $ pwd /c/Users/maya/Documents $ cd .. $ pwd /c/Users/maya
The command ____ moves you back up one level, into the parent of the folder you are currently in.
Typing out full folder names gets tedious fast, so the terminal has a shortcut: start typing a name and press Tab — it auto-completes as far as it can, and if there's more than one match, pressing Tab twice lists them. This is called tab completion, and using it constantly is one of the biggest speed differences between a beginner and someone comfortable at the command line.
Two more shortcuts worth knowing right away: cd by itself (no folder name) jumps straight back to your home folder from anywhere, and cd - jumps back to whichever folder you were in just before your last cd. Both save you from typing out a long path you'd otherwise have to retrace by hand.
Which command prints the full path of the folder you are currently standing in?
Pressing Tab while typing a folder name will try to auto-complete it for you.
Keep your streak going in Swipe Coding
Swipe through every level of Ship It on your iPhone — with XP, stars, streaks, a personal advisor and the full track beyond these free levels.
Get the Swipe apps →