Commands · Command

CommandWindowsLinuxmacOS

cd

cd [path]

Changes the current working directory in the shell — one of the few commands with meaningfully different behavior across platforms despite the identical name.

// PLATFORM NOTES

Windows

`cd` alone (no drive letter) does NOT switch drives — use `cd /d` (e.g. `cd /d D:\Projects`), or run the drive letter as its own command first.

Linux

shell builtin (not a standalone program on disk); `cd -` returns to the previous directory, `cd` alone goes home.

macOS

same shell-builtin behavior as Linux (bash/zsh).

// FLAGS

/dWindows only: switch drives along with the directory
-Linux/macOS only: shorthand for "the previous directory"

// EXAMPLE

cd .. — moves up one directory level, identical on every platform.

// GOTCHA

On Windows CMD, cd alone does NOT change drives — you need cd /d or a separate drive-letter command first; this is the single most common cd confusion for people used to Linux/macOS.

// RELATED COMMANDS