The cd command moves you between folders
To change directory in command line, type cd followed by a space and the name or path of the folder you want to enter. Press Enter. That's the whole action — cd stands for "change directory" and it's the same on Windows, Mac, and Linux.
The folder you're in right now is called your current directory. When you open a terminal or command prompt, you start in a default folder (usually your home folder). Every command you run happens in that folder unless you tell it otherwise. Moving between folders with cd is how you navigate to the files and programs you actually need to work with.
Key Takeaways
- Type cd foldername to enter a folder, or cd .. to go back one level to the parent folder.
- Use cd ~ to jump directly to your home folder from anywhere, no matter how deep you are in the folder structure.
- Type pwd to see the full path of the folder you're currently in if you get lost.
- Folder names with spaces need quotes around them: cd "My Documents" instead of cd My Documents.
- Tab completion fills in folder names automatically — type the first few letters and press Tab to save typing.
Moving into a folder one level down
If you can see a folder in your current location, you can enter it by typing its exact name. For example, if you're in your home folder and you have a folder called Documents, type cd Documents and press Enter. The prompt will change to show you're now inside that folder.
You only need to type the folder name itself, not the full path. The system assumes you mean a folder inside the one you're already in. If the folder name has spaces in it — like "My Documents" — wrap the name in quotes: cd "My Documents". Without quotes, the command line thinks each word is a separate instruction and fails.
Going back up one folder level
To move back to the folder that contains your current folder, type cd .. (that's cd, space, then two periods). The two periods are shorthand for "the parent directory." Press Enter and you'll move up one level.
You can chain these together if you need to go back multiple levels at once. Type cd ../.. to go back two levels, or cd ../../.. to go back three. Each .. takes you up one folder, and the slashes separate them. This is faster than typing cd .. three times in a row.
Jumping to your home folder from anywhere
No matter how deep you are in the folder structure, typing cd ~ takes you straight to your home folder. The tilde (~) is a shortcut that means "my home directory." This is useful when you've navigated several levels down and want to start over without typing multiple cd .. commands.
On Windows, you can also type cd %USERPROFILE% to reach your home folder, though ~ works in modern Windows 10 and 11 command prompts as well. On Mac and Linux, ~ is the standard and fastest way.
Using full paths to jump anywhere at once
Instead of moving one folder at a time, you can type the complete path to where you want to go. A full path starts from the root of your system and lists every folder down to your destination. On Mac and Linux, it starts with a forward slash: cd /Users/yourname/Documents/Projects. On Windows, it starts with a drive letter: cd C:\Users\yourname\Documents\Projects.
Full paths are useful when you know exactly where a folder is and don't want to navigate step by step. You can also mix relative and absolute paths — for instance, cd ~/Downloads/Work starts from your home folder and goes into Downloads, then into Work. This is faster than typing the entire path from the system root.
Checking where you are with pwd
If you lose track of which folder you're in, type pwd (print working directory) and press Enter. The command line will show you the complete path from the root of your system to your current location. This is especially helpful when you've navigated several levels deep and the folder names in the prompt aren't enough to orient you.
On Windows, the equivalent is cd typed by itself with no arguments — it prints your current path. On Mac and Linux, pwd is the standard command. Both work when ready and don't change anything; they just show you where you are.
Using tab completion to type folder names faster
When you start typing a folder name, press the Tab key and the command line will finish it for you — if the name is unambiguous. Type cd Doc and press Tab, and if you only have one folder starting with "Doc", it becomes cd Documents. If multiple folders start with those letters, Tab cycles through them or shows a list, depending on your system.
This saves typing and prevents typos. It also works with full paths: type cd /Users/yourname/D, press Tab, and the system completes it to the first matching folder. If nothing matches, Tab does nothing — that's a sign the folder name is spelled differently than you thought.
Frequently Asked Questions
What if I type a folder name and get "directory not found"?
The folder name is spelled differently, doesn't exist in your current location, or you're already inside it. Check the exact spelling with pwd and ls (or dir on Windows) to see what folders are actually there. Folder names are case-sensitive on Mac and Linux but not on Windows.
Can I use cd to go to a folder on a different drive on Windows?
Not directly — cd only moves within the same drive. To switch to a different drive, type the drive letter followed by a colon: D: moves you to the D drive. Then use cd to navigate within that drive. On Mac and Linux, all drives appear as folders within the root, so cd works across them.
What does cd / do?
It takes you to the root directory — the top level of your entire file system. On Mac and Linux, this is the absolute starting point. On Windows, it takes you to the root of your current drive. You rarely need to go here unless you're working with system files.
Why doesn't cd work with a folder I can see in my file browser?
The folder might be on a different drive, or the path might be longer than it appears. Use pwd to confirm your current location, then type the full path to the folder you want. If the folder name has special characters or spaces, wrap it in quotes.
Can I go back to the previous folder I was in without typing the path again?
On Mac and Linux, type cd - (cd, space, hyphen) to return to the last directory you were in. Windows command prompt doesn't have this built in, but PowerShell does. This is useful when you jump between two folders frequently.