Skip to main content

Understanding File Navigation Through Dialogue

When you give someone directions, you might say:

  • Absolute direction: "Go to 123 Main Street, downtown" (complete address from a fixed starting point)
  • Relative direction: "Go down this street and turn left at the next corner" (relative to where you are now)

File paths work exactly the same way. Your AI uses paths to navigate your computer's folder structure. Understanding paths through dialogue means you can supervise navigation safely and build a mental map of your project's organization.

This lesson teaches you to recognize:

  1. Absolute paths (complete addresses like /Users/yourname/projects)
  2. Relative paths (directions from where you are like cd folder-name)
  3. Path symbols that help navigate (.. means up one level, . means current folder)

File system tree showing root (/), home directory, common paths (Documents, Downloads), with pwd current location indicator and cd navigation arrows


Use cd to Navigate Folders

The cd (change directory) command moves you between folders. Let's see how both you and your AI use the same command.

Example 1: Navigate Using Absolute Path

Step 1: You Try It

Open your terminal and navigate to a folder using its complete path. For example:

$ cd ~/Documents
$ pwd
/Users/yourname/Documents

You're now in the Documents folder. The path /Users/yourname/Documents is absolute—it's a complete address that works from anywhere.

What to notice: You used a complete path starting with ~ (your home folder) or / (root). The pwd command confirms where you are.

Step 2: Your AI Does the Same

Ask your AI:

Prompt:

Navigate to your project root using an absolute path.
Show me pwd to confirm your location.

Expected AI Output:

$ cd /Users/mjs/Documents/code/panaversity-official/tutorgpt-build/colearning-python
$ pwd
/Users/mjs/Documents/code/panaversity-official/tutorgpt-build/colearning-python

Your AI uses an absolute path—a complete address just like you did.

Step 3: Compare and Understand

Your path: ~/Documents AI's path: /Users/mjs/Documents/code/panaversity-official/tutorgpt-build/colearning-python

Both are absolute paths because they start with / or ~ and specify a complete address. The folders are different because you're on different computers, but the pattern is identical.

💬 AI Colearning Prompt

"Why would you use an absolute path vs. a relative path when navigating? What are the tradeoffs?"


Use cd to Navigate Into Subfolders (Relative Paths)

Relative paths don't start with /. They navigate from where you currently are.

Step 1: You Try It

From your current folder, navigate into a subfolder using just its name:

$ cd Documents
$ pwd
/Users/yourname/Documents

You used cd Documents—just the folder name, not the full path. This is a relative path because it's relative to where you already are.

What to notice: No / at the start. Just the folder name. This only works if the folder exists in your current location.

Step 2: Your AI Does the Same

Ask your AI:

Prompt:

From your project root, navigate into a subfolder using a relative path (just the folder name).
Show pwd to confirm you moved.
Then explain: What's the difference between an absolute path and a relative path?

Expected AI Output:

$ cd book-source
$ pwd
/Users/mjs/Documents/code/panaversity-official/tutorgpt-build/colearning-python/book-source

Your AI uses a relative path—same approach you used.

Step 3: Compare and Understand

Your command: cd Documents (relative) AI's command: cd book-source (relative)

Both moved into a subfolder using just the folder name. Neither command started with /. This works when the folder exists in your current location.

Key insight: Relative paths are context-dependent. They only work if the folder exists where you are right now. That's why pwd is important—it shows you where you are before using a relative path.


Why Path Understanding Matters for Safety

Paths are critical for safe navigation. Consider this scenario:

Unsafe approach:

You: "Delete the backup folder" Agent: Deletes a folder Oh no—which backup folder? There might be multiple!

Safe approach:

You: "Delete the backup folder. But first, show me where we are and what backup folders exist." Agent: Shows absolute path and lists folders You: "Yes, delete /Users/mjs/backup-2024 but NOT /Users/mjs/backup-important"

By understanding paths—knowing exactly where your AI is—you prevent mistakes.

🎓 Expert Insight

In AI-native development, you don't memorize path syntax like ../../folder/subfolder. You understand the CONCEPT (go up two levels, then navigate to subfolder), and AI translates that to the correct path. Your job: verify AI is navigating to the RIGHT place.


Use cd .. to Go Up One Level

The special symbol .. means "parent folder" (one level up from where you are).

Step 1: You Try It

Navigate to a subfolder, then go back up to its parent folder:

$ cd Documents
$ pwd
/Users/yourname/Documents

$ cd ..
$ pwd
/Users/yourname

You used cd .. (two dots) to go up one level. This is a relative path special symbol meaning "parent folder."

What to notice: .. always means the same thing: go up one level. It works from anywhere.

Step 2: Your AI Does the Same

Ask your AI:

Prompt:

Navigate into a subfolder, then use cd .. to go back up to the parent folder.
Show pwd after each command.
Explain what .. means.

Expected AI Output:

$ cd book-source
$ pwd
/Users/mjs/Documents/.../book-source

$ cd ..
$ pwd
/Users/mjs/Documents/...

Your AI uses .. the same way you do.

Step 3: Compare and Understand

Both you and your AI used cd .. to move up one level. The command is identical. The starting and ending paths are different because you're on different computers, but the navigation logic is the same.

🤝 Practice Exercise

Ask your AI: "Navigate from your current directory to your home directory, then into Documents, then back up one level. After each navigation step, show me where you are with pwd."

Expected Outcome: You see the full navigation path and understand how cd, cd ~, and cd .. work together to move through the file system.


Try With AI: Side-by-Side Comparison

Now that you've navigated yourself, compare what happens when your AI navigates.

Comparison Prompt

Open your AI tool and ask:

Prompt:

Show me how you navigate through folders.
1. Start at your project root using pwd
2. Navigate down into a subfolder using a relative path
3. Show pwd to confirm your new location
4. Navigate back up using cd ..
5. Explain: Why do absolute paths work from anywhere, but relative paths depend on where you currently are?

What to Compare:

Navigation StepYou Do ThisYour AI Does This
Navigate down (relative)cd Documentscd book-source
See where you are/Users/yourname/Documents(AI's path)
Go back upcd ..cd ..
Confirm location/Users/yourname(AI's path)

Observation: Notice how you and your AI use identical commands (cd, ..) but in different locations. This is co-learning—you understand AI's navigation because you've practiced the same pattern yourself. When AI suggests a path, you can verify it makes sense.


Try With AI: Safety Verification

To practice supervising navigation before file operations, ask your AI:

Prompt:

Before you perform any file operation (copy, move, delete),
how would you make sure we're in the right folder?
Walk me through the safety steps for navigation.

Expected Response: Your AI will describe showing location with pwd and listing folders with ls before any operation. This is the foundation of safe collaboration—verifying location before taking action.

Key Insight: By navigating yourself first, you built the mental model to supervise AI's navigation. You're not blindly trusting—you're collaborating from understanding.