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
Key Facts
- The command `cd ..` navigates one level up in the directory hierarchy.
- The `..` notation universally refers to the parent directory in most operating systems.
- This command is essential for navigating file systems efficiently.
- It works in various command-line environments including Bash, Zsh, Windows Command Prompt, and PowerShell.
- Using `cd ..` multiple times allows you to move up multiple directory levels.
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:
- `cd`: This is the command to change the directory.
- ` `: A space separates the command from its argument.
- `..`: This is a special directory entry that represents the parent directory. Every directory (except the root directory) contains a pointer to its parent directory represented by `..`.
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:
- Linux/macOS (Bash, Zsh, etc.): Simply open the Terminal application and use `cd ..`.
- Windows (Command Prompt - cmd.exe): Open Command Prompt and use `cd ..`.
- Windows (PowerShell): Open PowerShell and use `cd ..`. PowerShell also offers an alias `Set-Location ..`, but `cd ..` is recognized for compatibility.
Other Navigation Commands
While `cd ..` is for moving up, here are a few other useful navigation commands:
- `cd` (with no arguments): Often returns you to your home directory.
- `cd
` : Moves you into a subdirectory named ``. - `cd /`: Moves you to the root directory of the file system.
- `cd ~`: Moves you to your home directory (common on Linux/macOS).
- `pwd` (Print Working Directory): Shows you the full path of your current directory (common on Linux/macOS).
- `dir` (Windows) or `ls` (Linux/macOS): Lists the contents of the current directory.
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.
More How To in Daily Life
Also in Daily Life
More "How To" Questions
Trending on WhatAnswers
Browse by Topic
Browse by Question Type
Sources
Missing an answer?
Suggest a question and we'll generate an answer for it.