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 12 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.

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 prompt now shows the new folder name. You are in the project folder, so you can start your assistant here.

Go back up

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

cd ..

Go to a folder you can see in Finder

On a 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.

If a folder name has spaces, put the whole path in quotes, for example cd "My Projects".

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

Sources