Folders in the Terminal: cd, ls and mkdir

Learn what a folder is in the terminal, see where you are, list files, make a new project folder and go into it on a Mac or a Windows PC, step by step.

Checked against official docs on 13 Oct 2026

On this page

An AI assistant works on the files in one folder: the folder where you start it. So before you start an assistant, you go to the right folder. This guide shows the four commands you need.

A folder (also called a directory) is a place that holds files and other folders. The terminal is always "in" one folder. That folder is the current folder. A new terminal usually starts in your home folder: the folder with your user name. On a Mac, ~ is a short name for the home folder.

A path is the address of a folder. It is a list of folder names. On a Mac, a path looks like /Users/anna/Documents. On Windows, it looks like C:\Users\anna\Documents.

You need an open terminal. If you do not have one, read How to open the terminal first.

See where you are

Mac: type this and press Return:

pwd

pwd prints the full path of the current folder, for example /Users/yourname.

Windows PowerShell: the prompt already shows the current folder, for example PS C:\Users\YourName>.

List what is in the folder

Mac:

ls

Windows PowerShell:

powershell
dir

You see the names of the files and folders inside the current folder. In PowerShell, ls also works: Microsoft lists ls and dir as short names for the same command.

Make a new project folder

Make a test folder for your first assistant session. The name my-first-project is only an example. Use a name without spaces.

Mac:

mkdir my-first-project

Windows PowerShell:

powershell
New-Item -Name "my-first-project" -ItemType "Directory"

The command makes the folder inside the current folder. Type ls or dir again to see it.

Go into the folder

cd means "change directory". It works on a Mac and in Windows PowerShell:

cd my-first-project

The terminal prints nothing when cd works. The prompt now shows the new folder name. On a Mac, you can type pwd to check. You are in the project folder, so you can start your assistant here.

You can also go to a folder deeper in the tree in one step. For example, go from your home folder into Documents:

cd Documents

Go back up

To go to the folder above the current one, type cd and two dots:

cd ..

Three short names help you with paths:

Short nameMeaning
.The current folder
..The folder above the current folder
~Your home folder (Mac)

On a Mac, cd ~/Documents goes to your Documents folder from any place.

Folder names with spaces

A space ends a word in the terminal. If a folder name has spaces, put the whole name in quotes:

cd "My Projects"

Go to a folder you can see in Finder or File Explorer

Mac: type cd and a space. Then drag the folder from Finder into the Terminal window. The full path of the folder appears on the line. Press Return.

Windows: open the folder in File Explorer. Right-click the folder. If you see Open in Terminal, click it. Microsoft lists this menu item for Windows Terminal installed in the normal way (from the Microsoft Store). The terminal opens in that folder.

Start your assistant in the folder

When you are in the right folder, start the assistant you installed:

AssistantCommandGuide
Claude CodeclaudeFirst session with Claude Code
Codex CLIcodexFirst session with Codex
Gemini CLIgeminiFirst session with Gemini CLI

If you see an error

The terminal shows an error when cd cannot do what you asked. The text below is what a Mac terminal prints (zsh, the Mac default).

  • cd: no such file or directory: Documnts: the name has a spelling error, or the folder is not inside the current folder. Type ls to see the exact names. Then type the name again.
  • cd: string not in pwd: Tax: you typed a name with a space but no quotes, for example cd Tax Returns. Type cd "Tax Returns" instead.
  • cd: not a directory: notes.txt: the name is a file, not a folder. You cannot go into a file.

If you use the older bash shell, the same errors read bash: cd: Documnts: No such file or directory and bash: cd: too many arguments.

In PowerShell, a wrong folder name gives a red error message that says the path does not exist. Type dir to see the exact names, then try again.

Windows: your Desktop or Documents folder looks empty. Windows can back up your Desktop and Documents folders to OneDrive (Microsoft calls this Known Folder Move). Your files can then be in a OneDrive folder, not where you looked. Open the folder in File Explorer and look at the address bar to see the real location. Then go there with cd or Open in Terminal.

Sources