Library / Terminal & command line / Working directory
No. 102·noun·also called current directory, cd, pwd

Working directory

The folder the terminal is currently "standing in," which is where commands look for files.

SPECIMEN · DIAGRAM · LAYERS
/Users/samYour home folder
codeWhere you keep projects
acmeProject root: commands run here
srcA folder inside the project
Definition

What it is

A directory is a folder. The working directory is the folder your terminal is in right now, and every command runs relative to it. Run npm install in the wrong folder and it either fails or installs things in the wrong place.

Three commands get you around: pwd (print where I am), ls (list what's here; dir on Windows), and cd (change directory, as in cd my-app). cd .. goes up one level.

The project root is the top folder of a project, usually where its package.json or README lives. Most commands an agent gives you assume you're there.

Say it like a builder

How to ask for it

Vague

“It says it can't find the file but the file is definitely there.”

Precise

“Running npm run dev says "missing script: dev." pwd shows I'm in /Users/sam/Downloads, and the project is in /Users/sam/code/acme. Confirm I should cd there first.”

Why it works

Sharing the working directory pinpoints the real problem (wrong folder) instead of a mystery about a missing file.

In the wild

You've seen this in

  • TThe folder name shown before the cursor in a terminal prompt
  • S"First, cd into the project folder" in setup guides
  • FFinder or File Explorer, which show the same folders visually
Usage note

Often confused with