The cd command moves you between folders

To change directories at the command prompt, type cd followed by a space and the name of the folder you want to enter, then press Enter. On Windows, the command prompt shows your current location before the cursor — when you change directories, that location updates to show where you are now.

The command works the same way on Windows Command Prompt, PowerShell, and Mac or Linux terminals. The folder structure is the only thing that changes between systems. Once you understand the basic syntax, you can navigate anywhere on your computer from the command line.

Key Takeaways

  • Type cd foldername to enter a folder one level deeper in the directory tree.
  • Type cd .. (two periods) to move up one level to the parent folder.
  • Type cd / on Mac or Linux, or cd C:\ on Windows, to jump to the root of your drive.
  • Use cd ~ on Mac or Linux to return to your home folder from anywhere.
  • Type the full path with slashes between folder names to jump multiple levels at once, like cd Documents/Projects/Website.

Moving into a folder one level down

When you open Command Prompt or Terminal, you start in a default location — usually your user folder on Windows or your home directory on Mac and Linux. From there, you can see the folders inside using the dir command on Windows or ls on Mac and Linux.

Once you know the name of a folder you want to enter, type cd followed by the folder name. For example, if you see a folder called Documents, type cd Documents and press Enter. The prompt updates to show you are now inside that folder. You can then use dir or ls again to see what is inside Documents.

Folder names with spaces need quotes around them. If you have a folder called "My Projects", type cd "My Projects" instead of cd My Projects. Without the quotes, the command prompt thinks you are trying to change to a folder called "My" and then run a separate command called "Projects".

Moving back up to the parent folder

To go back up one level to the folder that contains your current folder, type cd .. (that is two periods with no space between them) and press Enter. This works on Windows, Mac, and Linux. Each time you type it, you move up one level in the folder structure.

If you are three folders deep and want to go back two levels at once, you can type cd ..\.. on Windows or cd ../.. on Mac and Linux. The backslash on Windows and forward slash on Mac and Linux are the path separators — they tell the command prompt where one folder name ends and another begins.

Jumping to the root or home directory

The root of your drive is the top level — on Windows it is usually C:\, and on Mac or Linux it is /. To jump there from anywhere, type cd C:\ on Windows or cd / on Mac and Linux.

On Mac and Linux, you can also type cd ~ to jump directly to your home folder from anywhere on the system. The tilde (~) is a shortcut that always means "my home directory". This is faster than typing the full path, especially if you are several folders deep and want to start over from home.

Using full paths to jump multiple levels at once

Instead of moving one folder at a time, you can type the complete path from your current location to where you want to go. On Windows, paths use backslashes: cd Documents\Projects\Website. On Mac and Linux, paths use forward slashes: cd Documents/Projects/Website.

You can also start from the root of your drive by including it in the path. On Windows, type cd C:\Users\YourUsername\Documents\Projects. On Mac or Linux, type cd /Users/YourUsername/Documents/Projects. This takes you directly to that location without stopping at each folder along the way.

If you are not sure of the exact path, use dir or ls to see what folders exist at each level, then build the path step by step. This is safer than guessing at folder names, which is a common reason the command fails.

What to do when the command does not work

The most common error is a typo in the folder name. Command Prompt and Terminal are case-sensitive on Mac and Linux but not on Windows. If you type cd documents on Mac when the folder is actually called Documents, the command will fail. On Windows, both cd documents and cd Documents work the same way.

If you see an error like "The system cannot find the path specified" on Windows or "No such file or directory" on Mac and Linux, the folder either does not exist at that location or you misspelled the name. Go back one level using cd .., then use dir or ls to see the exact spelling of the folder you want to enter.

Spaces in folder names are another common source of errors. If you forget the quotes around a folder name with spaces, the command prompt stops at the first space and tries to run the rest as a separate command. Always use quotes when a folder name contains spaces.

Frequently Asked Questions

Can I use the cd command to change to a folder on a different drive on Windows?

Yes, but you need to change the drive first. Type D: to switch to the D drive, then use cd to navigate to the folder you want. If you try to use cd D:\FolderName while on the C drive, it will not work — you must change drives first.

What does the dot (.) mean in the command prompt?

A single dot (.) means your current folder. Two dots (..) mean the parent folder — the one that contains your current location. You will see these used in paths and commands throughout the command line.

How do I see the full path of where I am right now?

On Windows, the full path is already shown in the prompt before the cursor. On Mac and Linux, type pwd (print working directory) and press Enter to see the complete path of your current location.

Can I use tab to autocomplete folder names?

Yes. Type the first few letters of a folder name and press Tab. The command prompt will complete the name for you if it matches exactly one folder. If multiple folders start with those letters, press Tab again to cycle through the options.

What if a folder name has special characters like parentheses or ampersands?

Use quotes around the entire folder name, just as you would with spaces. For example, type cd "Folder (2024)" or cd "Project & Design". The quotes tell the command prompt to treat everything inside as a single folder name.