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:
pwdpwd 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:
lsWindows PowerShell:
dirYou 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-projectWindows 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-projectThe 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 DocumentsGo 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 name | Meaning |
|---|---|
. | 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:
| Assistant | Command | Guide |
|---|---|---|
| Claude Code | claude | First session with Claude Code |
| Codex CLI | codex | First session with Codex |
| Gemini CLI | gemini | First 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. Typelsto 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 examplecd Tax Returns. Typecd "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
- pubs.opengroup.org/onlinepubs/9799919799/utilities/cd.html
- pubs.opengroup.org/onlinepubs/9799919799/utilities/ls.html
- pubs.opengroup.org/onlinepubs/9799919799/utilities/mkdir.html
- pubs.opengroup.org/onlinepubs/9799919799/utilities/pwd.html
- support.apple.com/guide/terminal/apdb66b5242-0d18-49fc-9c47-a2498b7c91d5/mac
- support.apple.com/guide/terminal/trml106/mac
- learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/set-location?view=powershell-5.1
- learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-childitem?view=powershell-5.1
- learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-item?view=powershell-5.1
- learn.microsoft.com/en-us/sharepoint/redirect-known-folders
- learn.microsoft.com/en-us/windows/terminal/distributions