Moving around folders
20 min · Beginner
Need help? Ask a tutor on WhatsApp (opens in a new tab)Showing steps for Windows. They are marked “On Windows” below.
Every file lives in a folder, and folders sit inside other folders like the branches of a tree. The terminal always works inside one of those folders, and three short commands tell you where you are, what is there and how to move.
Where am I? The working directory
The working directory, or current folder, is the folder the terminal is working in right now. Commands look for files there unless you give them another path.
Priya types javac Hello.java and gets file not found, though the file is on her Desktop. The terminal was looking in another folder. pwd (print working directory) shows which one.
On Windows
A new PowerShell window starts in your home folder. You can also open PowerShell right inside the folder you want:
- Open the folder in File Explorer.
- Right-click an empty space in it → Open in Terminal.
- Or click File Explorer's address bar, type
powershelland press Enter.
Example 1 · Print the working directory
PS C:\Users\Priya> pwdPath ---- C:\Users\Priya
What this code does
- PowerShell prints the current folder under the heading
Path. A new window starts in your home folder,C:\Users\Priya. - The prompt
PS C:\Users\Priya>already shows the same folder, so in PowerShell a glance at the prompt is often enough.
What is here? ls
ls (list) shows the files and folders inside the working directory, so you can check that a file is really where you think it is.
On Windows
In PowerShell, ls prints a table. Priya is in her home folder:
PS C:\Users\Priya> ls Directory: C:\Users\Priya Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 21-10-2026 10:12 college-projects d-r--- 14-10-2026 09:30 Desktop d-r--- 14-10-2026 09:30 Documents d-r--- 20-10-2026 18:44 Downloads
- A
dat the start of Mode means a folder;-a----means a file. Length is a file's size in bytes. - Names that start with a dot, like
.gitignore, may be hidden.ls -Forceshows hidden items too. (ls -a, from Mac guides, is an error in PowerShell.)
Move with cd
A path is the address of a file or folder: the folder names from the top down, joined by slashes. For example C:\Users\Priya\college-projects on Windows, or /Users/priya/college-projects on a Mac.
cd (change directory) takes a path and moves the terminal there. Two short names help: .. means one level up, and ~ means your home folder.
On Windows
Priya's folders on Windows. Wherever she is, cd .. goes up one level and cd ~ goes home.
Example 2 · Down, up and home again
PS C:\Users\Priya> cd college-projectsPS C:\Users\Priya\college-projects> cd java-basics PS C:\Users\Priya\college-projects\java-basics> cd .. PS C:\Users\Priya\college-projects> cd ~ PS C:\Users\Priya>
What this code does
- Each
cdprints nothing; instead the prompt changes to the new folder. Read the prompt to see where you are. cd java-basicsgoes down into a folder inside this one,cd ..goes back up one level, andcd ~jumps home from anywhere.
Absolute and relative paths
An absolute path starts at the top (C:\ on Windows, / on a Mac) and works from any folder. A relative path starts from the working directory, so its meaning changes when you move.
cd college-projects worked only because Priya was in her home folder, where college-projects sits. From any other folder she needs the full, absolute path.
On Windows
On Windows a path starts with a drive letter, and \ separates the names. From Documents, an absolute path goes straight to java-basics:
PS C:\Users\Priya\Documents> cd C:\Users\Priya\college-projects\java-basicscdprints nothing when it works; the prompt changes to show the new folder.- Another drive?
cd D:\collegemoves to drive D: and itscollegefolder in one step. - PowerShell also accepts
/in paths, socd college-projects/java-basicsworks too.
Names with spaces, and the Tab key
The shell splits a command at every space. So cd My Notes hands cd two words, My and Notes, and fails.
Example 3 · A space in the name
PS C:\Users\Priya\college-projects> cd My NotesSet-Location : A positional parameter cannot be found that accepts argument 'Notes'.
What this code does
Set-Locationis PowerShell's full name forcd. The message means:cdtakes one folder, but it also got a second word,Notes.cd "My Notes"passes the whole name as one word, and it works.
Put quotes around the name: cd "My Notes". Even easier, type cd My and press Tab: the shell finishes the name and adds the quotes for you. Tab works for every file and folder name, so use it all the time.
For your own projects, avoid spaces: college-projects or java_basics never need quotes.
Next step
Check your understanding
8 quick questions