What is cd?

cd stands for “change directory”. It is a command you type in a command‑line interface (like Windows Command Prompt, PowerShell, macOS Terminal, or Linux shell) to move from your current folder to another folder on your computer.

Let's break it down

  • cd - the command itself.
  • directory - another word for a folder.
  • cd foldername - tells the system to go into the folder named “foldername”.
  • cd .. - moves you up one level to the parent folder.
  • cd / or *cd * - jumps straight to the root folder (the top‑most folder on the drive).
  • cd ~ - on Unix‑like systems, takes you to your home directory.

Why does it matter?

Navigating the file system is the first step to doing anything else in a terminal: running programs, editing files, copying or deleting data, and running scripts. If you can’t get to the right folder, the commands you type won’t affect the files you intend.

Where is it used?

  • In Windows Command Prompt and PowerShell.
  • In macOS Terminal, Linux shells (bash, zsh, fish, etc.), and other Unix‑like environments.
  • Inside scripts and batch files to set the working directory before executing other commands.

Good things about it

  • Simple and fast: just type a few characters.
  • Works the same way on almost every operating system, so the skill transfers.
  • No need for a mouse; you can stay entirely in the keyboard, which speeds up many workflows.
  • Works inside scripts, making automated tasks possible.

Not-so-good things

  • It only changes the directory for the current session; opening a new terminal window starts you back at the default location.
  • Mistyping a path can lead to “folder not found” errors, which can be confusing for beginners.
  • On Windows, you must include the drive letter (e.g., cd D:\Projects) to switch drives, which is an extra step compared to Unix‑like systems.
  • It does not give visual feedback about the folder’s contents; you need another command (like ls or dir) to see what’s inside.