Skip to content
zero2vibecodelearn vibe coding
Level 1 · Files, folders, paths 5 min Reviewed by the author · Aug 4, 2026

Moving around: cd

`cd` walks you into a folder, `cd ..` walks you back out, and `cd ~` teleports you home. Three moves cover the whole disk.

Level 1 · 0 / 4 lessons0%

You know where you are. Now move.

cd — change directory

cd takes one argument: where you want to go.

cd projects

You are now inside projects. The updates to show it, and ls from here lists a different set of names.

Notice that cd printed nothing. That is not a glitch — it is the Unix convention: tools stay quiet when they succeed and only speak when something goes wrong. If you ever see output from cd, read it, because it is an error.

Quick check

You run `cd projects` and nothing is printed. What happened?

Going back up: ..

Every folder contains a hidden entry called .. that means “the folder above me”.

cd ..

From /home/user/projects that puts you back in /home/user. Chain it to go up further:

cd ../..

Note

There is also ., which means “the folder I am in right now”. It looks useless until you meet commands that need to be told a target explicitly — cp file.txt . means “copy it right here”, and git add . means “everything in this folder”.

Going home: ~

cd ~ takes you to your home folder from anywhere, no matter how deep you are. So does plain cd with no argument at all.

cd ~
cd

Both land you in /home/user. This is your escape hatch when you are lost.

Quick check

You are somewhere deep and completely lost. What is the quickest way back to a known place?

Several steps at once

A can name more than one step, separated by /:

cd projects/website

That is the same as cd projects followed by cd website. It also works with ..:

cd ../downloads

means “up one, then into downloads”.

Tip

Press Tab while typing a folder name and the terminal completes it for you. It also refuses to complete names that do not exist, which makes Tab a free spell-checker for paths.

Try it

Take a walk and come back:

  1. cd projects
  2. cd website
  3. pwd — confirm you are in /home/user/projects/website
  4. cd .. — back up to projects
  5. cd ~ — home again

Watch the prompt change at each step. That changing prompt is the reason you rarely need pwd once you have the habit.

Quick check

From /home/user/projects/website, what does `cd ../notes` do?

Check your understanding

Answered 0/3
Mode:

What does `cd ..` do?

You are in `/home/user/projects/website`. Where does `cd ~` take you?

Why does `cd` print nothing when it works?

Finish the task in the terminal and answer the questions to complete the lesson.

📝 My notes

Saved automatically in this browser · shows up on the Notes page.

Task

Walk into projects, then into website, then back out, then home.

Tab complete · history · Ctrl+L clear · help commands

  • Not done: Step into the projects folder
  • Not done: Confirm with pwd that you got there
  • Not done: Step back up one level
  • Done: Finish in your home folder

Lesson Q&A

What does `cd ..` do?

`..` always means "the folder one step up". It is a name every folder has.

You are in `/home/user/projects/website`. Where does `cd ~` take you?

`~` means your home folder, no matter how deep you currently are.

Why does `cd` print nothing when it works?

Silence means success. If cd has something to say, it is because something went wrong.

You run `cd projects` and nothing is printed. What happened?

Success is silent. An error would have printed something like 'No such file or directory'.

You are somewhere deep and completely lost. What is the quickest way back to a known place?

cd ~ (or plain cd) is one move, independent of how deep you are. Repeated cd .. works but is slower and easy to overshoot.

From /home/user/projects/website, what does `cd ../notes` do?

A path is read step by step. .. is the first step (up to projects), notes is the second.

Move between lessons with · search with ⌘K