Home Explore Blog CI



nushell

commands/docs/cd.md
a0c53078fa10113fc0dc72f47f7127a51a20afe90eeed2cd00000003000004bd
---
title: cd
categories: |
  filesystem
version: 0.104.0
filesystem: |
  Change directory.
usage: |
  Change directory.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

# `cd` for [filesystem](/commands/categories/filesystem.md)

<div class='command-title'>Change directory.</div>

## Signature

```> cd {flags} (path)```

## Flags

 -  `--physical, -P`: use the physical directory structure; resolve symbolic links before processing instances of ..

## Parameters

 -  `path`: The path to change to.


## Input/output types:

| input   | output  |
| ------- | ------- |
| nothing | nothing |
## Examples

Change to your home directory
```nu
> cd ~

```

Change to the previous working directory (same as "cd $env.OLDPWD")
```nu
> cd -

```

Changing directory with a custom command requires 'def --env'
```nu
> def --env gohome [] { cd ~ }

```

Move two directories up in the tree (the parent directory's parent). Additional dots can be added for additional levels.
```nu
> cd ...

```

The cd command itself is often optional. Simply entering a path to a directory will cd to it.
```nu
> /home

```

Chunks
3866d375 (1st chunk of `commands/docs/cd.md`)
Title: cd command documentation
Summary
This document describes the `cd` command, used for changing the current directory in Nushell. It details the command's signature, flags (like `--physical` to resolve symbolic links), and parameters (the target path). The document also provides usage examples, including changing to the home directory, navigating to the previous directory, using custom commands with environment definitions, moving up multiple levels in the directory tree, and directly entering paths to change directories.