# cd

> A command that moves you into another folder. Two dots go up one.

**Field:** Infrastructure  
**Category:** Linux & the Command Line  
**Also known as:** cd Command, Change Directory, Change Folder

## Think of it like

Think of it like walking from one room to another. You are now in a new room.

## Definition

The cd command moves you into another folder. Its name is short for change directory. You type cd and then the path, like cd /var/log. Two dots, .., take you up one folder. The sign ~ takes you home. After cd, every command runs from the new folder.

## Example

Lucy needs the web server's logs. She types cd /var/log/nginx, then ls to see them.

## Example code

```console
$ cd /var/log
$ cd ..
$ pwd
/var
```

Move into the log folder, then up one. Now you are in /var.

## Why it matters

It is how you get around a server. Almost every task starts with a cd.

## Common mistake

Forgetting the slash at the start. cd var looks inside the current folder, but cd /var starts from the root.

## Three principles

- **Move in.** cd and a path.
- **Move up.** cd .. goes up one.
- **Go home.** cd ~ from anywhere.

## Related terms

- [pwd](https://learn.benibix.com/term/infrastructure/pwd-command)
- [ls](https://learn.benibix.com/term/infrastructure/ls-command)
- [Home Directory (~)](https://learn.benibix.com/term/infrastructure/home-directory)
- [Root Directory (/)](https://learn.benibix.com/term/infrastructure/root-directory)
- [File Path](https://learn.benibix.com/term/development/file-path)

## Taught in

- [The Linux File Tree](https://learn.benibix.com/learn/infrastructure-linux/linux-file-tree): Linux CLI, 4/10

![A folder tree with a single slash at the top, the root. Below it hang etc, home, root and var. Under home sits emma, marked with a tilde as her home folder and with a you-are-here marker. Inside emma are notes.txt, photos and two faded hidden items, .bashrc and .ssh. Under var sits log. An arrow shows a cd move from emma down to var/log.](https://learn.benibix.com/diagrams/inf3-file-tree.svg)

---

Source: https://learn.benibix.com/term/infrastructure/cd-command
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
