The cd command moves you between folders in Gemini CLI

To change directories in Gemini CLI, type cd followed by a space and the folder path you want to enter, then press Enter. The command works the same way as it does in any other command-line interface — it tells the terminal to move your working location from one folder to another.

Once you change into a folder, all commands you run will affect files in that location unless you specify a different path. This is why knowing how to navigate between directories is one of the first things you need to do when working in the terminal.

Key Takeaways

  • Type cd foldername to enter a folder that is inside your current location.
  • Type cd .. to move up one level to the parent folder.
  • Type cd ~ to jump directly to your home directory from anywhere.
  • Type pwd to see which folder you are currently in if you get lost.
  • Folder names with spaces must be wrapped in quotes, like cd "My Documents".

Moving into a folder inside your current location

If you want to enter a folder that sits inside the folder you are already in, type cd followed by the folder name. For example, if you are in your home directory and you have a folder called Projects, type cd Projects and press Enter. The terminal will move you into that folder.

You can see what folders exist in your current location by typing ls (on Mac or Linux) or dir (on Windows) and pressing Enter. This shows you the names of all folders and files in your current spot, so you know what you can navigate into.

Moving up to the parent folder

To move up one level — from a folder back into the folder that contains it — type cd .. (that is cd, a space, and two periods). This takes you to the parent directory. If you are in Projects and you type cd .., you will move back to your home directory.

You can chain this command to move up multiple levels at once. Typing cd ../.. moves up two levels, cd ../../.. moves up three levels, and so on. This is faster than typing cd .. multiple times.

Jumping directly to your home directory

No matter where you are in the file system, typing cd ~ takes you directly to your home directory. The tilde symbol (~) is a shortcut that represents your home folder, so this command saves you from having to type out the full path or move up multiple levels one at a time.

On Windows systems, you can also type cd %USERPROFILE% to reach your home directory, though cd ~ works in modern versions of Windows PowerShell as well.

Using full paths to navigate anywhere

Instead of moving one folder at a time, you can type the entire path from your home directory or from the root of your system. On Mac and Linux, a path starting with a forward slash (/) is measured from the root. For example, cd /Users/yourname/Documents/Projects takes you directly to that location.

On Windows, paths use backslashes and a drive letter. For example, cd C:\Users\yourname\Documents\Projects navigates to that folder. You can also use forward slashes in modern Windows terminals, which often works the same way.

Handling folder names with spaces or special characters

If a folder name contains spaces, you must wrap the name in double quotes so the terminal treats it as a single folder name. For example, if you have a folder called My Documents, type cd "My Documents" instead of cd My Documents. Without the quotes, the terminal reads My and Documents as two separate things and returns an error.

Some special characters like parentheses, ampersands, or dollar signs can also cause problems. Wrapping the entire path in quotes is the simplest fix. Alternatively, you can use a backslash before each special character to tell the terminal to treat it literally — for example, cd My\ Documents — but quotes are usually easier.

Checking where you are with pwd

If you lose track of which folder you are in, type pwd (print working directory) and press Enter. The terminal shows you the full path of your current location. This is useful when you have navigated through several folders and need to confirm where you are before running a command.

After you know your location, you can navigate from there using any of the methods above — moving up with .., jumping to home with ~, or typing a full path to go somewhere else entirely.

Frequently Asked Questions

What happens if I type a folder name that does not exist?

The terminal returns an error message, usually something like "No such file or directory" or "cannot access". Check the spelling of the folder name by typing ls or dir to see what folders actually exist in your current location, then try the cd command again with the correct name.

Can I use tab to complete folder names automatically?

Yes. Type cd, a space, and the first few letters of the folder name, then press Tab. The terminal fills in the rest of the name automatically if it matches only one folder. If multiple folders start with those letters, press Tab again to see the options.

How do I navigate to a folder on a different drive on Windows?

Type the drive letter followed by a colon and the path, like cd D:\Backups. If you are on drive C and want to switch to drive D, you can also type just D: and press Enter, then use cd to navigate within that drive.

What is the difference between cd and cd .?

The period (.) represents your current directory. Typing cd . does nothing — it keeps you in the same folder. Two periods (..) represent the parent folder, which is why cd .. moves you up one level.