Linux for Developers Course
Linux for Developers
/
Beginner

cd

Definition

Change Directory. The command used to navigate and switch between different directories in the filesystem.

Explain Like I'm New

Walking through doors. If you are in the living room and want to go to the kitchen, you type `cd kitchen`.

Real World Example

Typing `cd /var/log` jumps you instantly to the system logs folder. Typing `cd ..` moves you exactly one folder backwards (up) the tree. Typing just `cd` instantly teleports you back to your personal home folder.

Common Use Cases

  • •Filesystem navigation

Interview Questions

basic

  • What does the command `cd ..` do?

intermediate

  • What is the difference between `cd /var` and `cd var`?

Flash Cards

Question

What does cd .. do?

Click to reveal answer
Answer

It moves you up exactly one level into the parent directory.

Question

/var vs var?

Click to reveal answer
Answer

`cd /var` uses an absolute path and takes you to the system's root `var` folder, no matter where you currently are. `cd var` uses a relative path, attempting to find a folder named 'var' inside the exact room you are currently standing in.