Start with your current folder

A terminal works from a current folder, also called the working directory. When you run a command that uses a relative path, the terminal interprets that path from where you are now. Before looking for a file or moving somewhere else, it helps to check your location.

You need a terminal running Bash or Zsh on macOS or Linux, or PowerShell 5.1 or later on Windows. In Bash or Zsh, enter pwd to print the working directory. In PowerShell, pwd also works; its full command name is Get-Location. The displayed path tells you where subsequent commands will start. Paths look different across operating systems, but they serve the same purpose: identifying a location in the folder tree.

Your terminal prompt may show part of the current path, but prompts vary. Running pwd is a more dependable way to check, especially after you have followed several instructions or opened a new terminal window.

Move with cd

The command cd means “change directory.” To enter a folder named notes inside your current folder, type cd notes. To move up to its parent folder, type cd ... After either command, run pwd to confirm where you landed. Moving up does not delete or change the folder; it only changes the terminal’s current location.

You can also give cd a path rather than a single folder name. A relative path, such as cd projects/website, starts from the current folder in Bash or Zsh. In PowerShell on Windows, you would normally write that example as cd projects\website. An absolute path starts at a location such as / on macOS or Linux, or a drive such as C:\ on Windows. Absolute paths are useful when you know exactly where you want to go, regardless of your starting folder.

Folder names containing spaces need care. Put the path in quotes, as in cd "project notes". If you see an error saying a path cannot be found, check the spelling and your current location with pwd. Then list the nearby folders before trying again.

List what a folder contains

In Bash or Zsh, enter ls to list the names of items in the current folder. In PowerShell, use Get-ChildItem; ls is also an alias for it in the PowerShell versions covered here. A listing can contain both files and folders. To inspect another folder without moving into it, provide its path: ls notes in Bash or Zsh, or Get-ChildItem notes in PowerShell.

Some items are hidden from an ordinary listing. On macOS and Linux, names beginning with a dot are usually hidden; ls -a includes them. In PowerShell, Get-ChildItem -Force shows items that a normal listing may omit. Hidden items often include configuration files, so look before changing anything unfamiliar.

Listing a folder and entering it are separate actions. Use a listing when you need to discover an exact name; use cd when you want that folder to become your working directory. This distinction helps prevent a common mistake: trying to enter a file with cd. If an item is a file, you can list it, but you cannot make it the current folder.

Try a small navigation exercise

You can practice without relying on folders that may or may not exist on your computer. First, go to your home folder with cd ~. Create a folder by entering mkdir terminal-practice, then enter it with cd terminal-practice. Inside it, create another folder with mkdir notes. These commands work in Bash, Zsh, and PowerShell. If terminal-practice already exists, skip its creation and enter it instead.

Now run pwd and check that the displayed path ends with terminal-practice. List the folder with ls in Bash or Zsh, or Get-ChildItem in PowerShell; you should see notes. Enter cd notes, check pwd again, and then use cd .. to return to terminal-practice. List its contents once more to confirm where you are.

If a command fails, pause rather than guessing another path. Check your location with pwd, list its contents, and compare the displayed names with what you typed. That simple loop—check location, list contents, then move—makes terminal navigation easier to follow and easier to debug.

Back to category ↗