How to cd back one directory

Content on WhatAnswers is provided "as is" for informational purposes. While we strive for accuracy, we make no guarantees. Content is AI-assisted and should not be used as professional advice.

Last updated: April 4, 2026

Quick Answer: To change back one directory in a command-line interface (like Terminal on macOS/Linux or Command Prompt/PowerShell on Windows), you use the command `cd ..`. The `cd` command stands for 'change directory', and the two dots `..` represent the parent directory.

Key Facts

Overview

Navigating through file systems using a command-line interface is a fundamental skill for many users, especially developers, system administrators, and power users. One of the most common tasks is moving between directories. Sometimes you find yourself in a subdirectory and need to return to the directory that contains it, often referred to as the parent directory. The standard command for this action across most operating systems is remarkably simple and consistent.

Understanding Directory Navigation

In a command-line interface (CLI), directories are organized in a hierarchical structure, much like a filing cabinet with folders inside other folders. The current working directory is the directory in which your command-line session is currently located. When you execute commands, they are typically performed within this context. To move around this structure, you use commands that change your current working directory.

The primary command for changing directories is universally known as `cd`, which stands for 'change directory'. This command takes an argument specifying the target directory you wish to move into.

How to Go Back One Directory

To move back one level, meaning to go from your current directory to its parent directory, you use a special notation: two dots (`..`). So, the complete command is:

cd ..

Let's break this down:

Example Scenario

Imagine your file system structure looks like this:

/home/user/documents/projects/

If your current working directory is /home/user/documents/projects/, and you want to move back to the documents directory, you would execute the command:

cd ..

After running this command, your new current working directory would be /home/user/documents/.

Moving Up Multiple Levels

You can chain the `..` notation to move up multiple directory levels. For instance, if you are in /home/user/documents/projects/ and want to go directly to the /home/user/ directory, you would use:

cd ../..

This command first tells the system to go up one level (to /home/user/documents/) and then from there, go up another level (to /home/user/).

Platform Specifics

The `cd ..` command is remarkably consistent across different operating systems and shells:

Other Navigation Commands

While `cd ..` is for moving up, here are a few other useful navigation commands:

Conclusion

Mastering basic command-line navigation, particularly the `cd ..` command, is a crucial step in becoming proficient with command-line interfaces. Its simplicity and universality make it an indispensable tool for efficiently managing files and directories without relying on graphical interfaces.

Sources

  1. Command-line interface - WikipediaCC-BY-SA-4.0
  2. CD Command - Change Directory | Microsoft Learnfair-use
  3. cd - change directory - Linux man page - SS64fair-use

Missing an answer?

Suggest a question and we'll generate an answer for it.