File Navigation
Folder Structure
Computer Tips
Tech Guide
Directory Management

How to navigate a few folders up?

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

To move a few folders up, use the parent-directory marker .. repeatedly in a relative path. The exact command depends on the shell, but the idea is the same everywhere: each .. means "go to the parent of the current directory."

Moving up in a terminal

On Unix-like shells such as bash, zsh, and fish, use cd with one or more .. path segments:

bash
1pwd
2/Users/mark/project/src/components
3
4cd ..
5pwd
6/Users/mark/project/src
7
8cd ../..
9pwd
10/Users/mark/project

Each slash-separated .. moves up one level. So:

  • 'cd .. moves up one folder'
  • 'cd ../.. moves up two folders'
  • 'cd ../../.. moves up three folders'

You can also move up and then down into another directory in one command:

bash
cd ../../tests

That means "go up two levels, then enter tests."

Windows shells do the same thing

In Command Prompt and PowerShell, the same relative path concept applies:

powershell
cd ..\..

PowerShell also accepts forward slashes in many cases, but backslashes are the normal Windows style.

If you want to confirm where you are after moving, use:

powershell
Get-Location

or in Command Prompt:

cmd
cd

Why .. works

File systems are hierarchical. The current directory has a parent, and .. is the standard path token for that parent. This makes relative navigation convenient because you do not need to type the full absolute path each time.

For example, if you are in:

/home/alex/projects/api/src

then:

  • '.. means /home/alex/projects/api'
  • '../.. means /home/alex/projects'
  • '../../docs means /home/alex/projects/docs'

Useful companion commands

When navigating often, these commands help:

bash
1pwd        # print the current directory
2ls         # list files in the current directory
3pushd ..   # move and remember the old location
4popd       # return to the remembered location

pushd and popd are especially useful when you need to jump around temporarily and then come back.

In shell scripts, relative navigation is safest when you first understand where the script starts. Many bugs come from calling cd ../.. under the assumption that the current directory is one thing when it is actually another. If the location matters, print pwd or resolve the script directory explicitly before moving around.

GUI equivalents

If you are not in a terminal, most file managers have an "up" action that moves to the parent folder. The concept is the same even though the interface is graphical rather than command-based.

That said, the terminal version is usually faster once you are comfortable with relative paths.

Once you understand .., file navigation stops feeling like memorizing commands and starts feeling like composing small path building blocks. That is the real skill behind moving around quickly.

Common Pitfalls

  • Using cd ... with three dots. That is not the standard parent-directory syntax.
  • Forgetting the separator between levels. It is ../.., not .....
  • Confusing relative paths with absolute paths and ending up in the wrong location.
  • Running cd from a script and expecting it to change the parent shell's current directory.
  • Mixing Windows backslashes and Unix paths without knowing which shell you are in.

Summary

  • Use cd .. to move up one folder and repeat .. to move up more levels.
  • 'cd ../.. means "up two directories."'
  • You can combine upward movement with a destination path such as cd ../../tests.
  • 'pwd, ls, pushd, and popd make navigation easier.'
  • The concept is the same across Unix shells, PowerShell, and Command Prompt even if the path separators differ.

Course illustration
Course illustration

All Rights Reserved.