• Home
  • Python
    • Introduction to Python
    • Python Developer
  • JavaScript
    • Introduction to JavaScript
    • JavaScript Developer
  • React.js
    • Introduction to React
    • React Developer
  • TypeScript
    • Introduction to TypeScript
    • TypeScript Developer
  • Linux Shell
    • Introduction to the Linux Shell
    • Linux Shell Developer
  • C++
    • Introduction to C++
    • C++ Developer
  • C Language
    • Introduction to C
    • C Developer
  • Rust
    • Introduction to Rust
    • Rust Developer
  • Zig
    • Introduction to Zig
    • Zig Developer
  • Interactive Training
  • Pricing
  • Brainstorm
STEMTrainingGrounds
  • Courses
    • Home
    • Python
      • Introduction to Python
      • Python Developer
    • JavaScript
      • Introduction to JavaScript
      • JavaScript Developer
    • React
      • Introduction to React
      • React Developer
    • TypeScript
      • Introduction to TypeScript
      • TypeScript Developer
    • Linux Shell
      • Introduction to the Linux Shell
      • Linux Shell Developer
    • C++
      • Introduction to C++
      • C++ Developer
    • C Language
      • Introduction to C
      • C Developer
    • Rust
      • Introduction to Rust
      • Rust Developer
    • Zig
      • Introduction to Zig
      • Zig Developer
  • Interactive Training
  • Pricing
  • Navigate
    • Home
    • Reading Grounds
    • Brainstorm

Quick Links

  • About Us
  • Pricing
  • Partnership
  • Brainstorm
  • Terms
  • Privacy
  • Refunds

Courses

  • Python
    • Introduction to Python
    • Python Developer
  • JavaScript
    • Introduction to JavaScript
    • JavaScript Developer
  • React
    • Introduction to React
    • React Developer
  • TypeScript
    • Introduction to TypeScript
    • TypeScript Developer
  • Linux Shell
    • Introduction to the Linux Shell
    • Linux Shell Developer
  • C++
    • Introduction to C++
    • C++ Developer
  • C Language
    • Introduction to C
    • C Developer
  • Rust
    • Introduction to Rust
    • Rust Developer

Newsletter

Subscribe to our free monthly newsletter, for a quick update on Python, JavaScript, and React news

© 2025 - 2026 STEMTrainingGrounds. All Rights Reserved.

Introduction to the Linux Shell -

Lesson 3 of 23

Lesson Progress: 0%

Lesson Progress: 0%
Lesson Incomplete
← Previous: Linux ls command II
Lesson 3 of 23
Next: Linux pwd command →

The cdcommand stands for "change directory" and is how you move between folders in the Linux shell. When you open a terminal, you start in your home folder, and cd lets you navigate to any other folder on the system. You can move into a subfolder with a name like Documents, go back to the parent folder with cd .., or jump straight to your home folder with cd ~. You can also use full paths like cd /tmp to go anywhere, or use cd - to return to the folder you were just in. Mastering cd is essential because every other command you run depends on being in the right place.

  • The simplest way to use cd is to type it followed by the name of a folder inside your current directory.
  • For example, cd Documents moves you into the Documents folder.
  • After you run cd Documents, the prompt changes to show you are now inside the Documents folder.
  • You can verify your new location by typing pwd, which prints the current directory path.
  • Type cd Documents to move into the Documents folder and see how the prompt changes.
  • The special name ..means "the parent folder" — the folder that contains the current one.
  • If you are inside Documents, typing cd .. takes you back to your home folder.
  • You can chain multiple .. levels together like cd ../.. to go up two levels at once.
  • The .. entry exists in every folder and is created automatically by the filesystem.
  • Try cd .. to move up one level from wherever you are.
  • The tilde character ~is a shortcut that always means "your home folder."
  • Typing cd ~ from anywhere in the filesystem will return you to your home folder.
  • Your home folder is usually /home/user in this simulator.
  • Using ~ is faster than typing the full path /home/user every time.
  • You can also use ~ with other paths, like ls ~/Documents, to refer to folders inside your home directory.
  • An absolute path starts with a forward slash / and describes the full location from the root of the filesystem.
  • For example, /tmp is the full path to the temporary files folder, no matter which directory you are currently in.
  • Absolute paths always work the same way, regardless of your current location.
  • This is different from a relative path like Documents, which only works if Documents exists inside your current folder.
  • Type cd /tmp to jump directly to the temporary folder using its absolute path.
  • You can use an absolute path with cd to jump directly to any folder on the system.
  • cd /home/user/Documents takes you straight to the Documents folder using its full path from the root.
  • Absolute paths always start with / and work from any location.
  • This is useful when you know exactly where a folder is and want to go there without stepping through each parent.
  • Try cd /home/user/Documents to move directly to your Documents folder from anywhere.
  • A relative path like ../var combines the parent shortcut .. with a folder name to navigate.
  • From your home folder /home/user, cd ../var goes up to /home and then into /home/var.
  • You can chain as many path parts as you need, like cd ../../etc to go up two levels and then into etc.
  • Relative paths are flexible because they work from wherever you are standing.
  • Try cd ../var to practice moving up one level and then into a different folder.

Test Incomplete

What does the cd command do?

Question #

1/15

Score

0/0 - 0.0 %

Task Incomplete
Example
~$ cd Documents
  • Run cd Documents to move into the Documents folder
Linux Shell
~$
Task Incomplete
Example
~$ cd ..
  • Run cd .. to move to the parent directory
Linux Shell
~/Documents$
Task Incomplete
Example
~$ cd ../var
  • Run cd ../var to practice relative navigation
Linux Shell
~$
Task Incomplete
Example
~$ cd ~
  • Run cd ~ to return to your home folder
Linux Shell
/tmp$
Task Incomplete
Example
~$ cd /tmp
  • Run cd /tmp to jump to the temp folder using an absolute path
Linux Shell
~$
Task Incomplete
Example
~$ cd /home/user/Documents
  • Run cd /home/user/Documents to go directly to Documents
Linux Shell
~$