This will create all three directories even if none of them currently exists. On Linux/Unix, this requires `mkdir -p`.
- Will not error if the directory already exists. For example:
```nu
mkdir modules/my/new_module
mkdir modules/my/new_module
# => No error
```
::: tip
A common mistake when coming to Nushell is to attempt to use `mkdir -p <directory>` as in the native Linux/Unix version. However, this will generate an `Unknown Flag` error on Nushell.
Just repeat the command without the `-p` to achieve the same effect.
:::
## Changing the Current Directory
```nu
cd cookbook
```
To change from the current directory to a new one, use the [`cd`](/commands/docs/cd.md) command.
Changing the current working directory can also be done if [`cd`](/commands/docs/cd.md) is omitted and a path by itself is given:
```nu
cookbook/
```
Just as in other shells, you can use either the name of the directory, or if you want to go up a directory you can use the `..` shortcut.
You can also add additional dots to go up additional directory levels:
```nu
# Change to the parent directory
cd ..
# or
..
# Go up two levels (parent's parent)
cd ...
# or
...
# Go up three levels (parent of parent's parent)
cd ....
# Etc.
```
::: tip
Multi-dot shortcuts are available to both internal Nushell [filesystem commands](/commands/categories/filesystem.html) as well as to external commands. For example, running `^stat ....` on a Linux/Unix system will show that the path is expanded to `../../..`
:::
You can combine relative directory levels with directory names as well:
```nu
cd ../sibling
```
::: tip IMPORTANT TIP
Changing the directory with [`cd`](/commands/docs/cd.md) changes the `PWD` environment variable. This means that a change of a directory is kept to the current scope (e.g. block or closure). Once you exit the block, you'll return to the previous directory. You can learn more about this in the [Environment](./environment.md) chapter.
:::
## Filesystem Commands
Nu also provides some basic [filesystem commands](/commands/categories/filesystem.html) that work cross-platform such as:
- [`mv`](/commands/docs/mv.md) to rename or move a file or directory to a new location
- [`cp`](/commands/docs/cp.md) to copy an item to a new location
- [`rm`](/commands/docs/rm.md) to remove items from the filesystem
::: tip NOTE
Under Bash and many other shells, most filesystem commands (other than `cd`) are actually separate binaries in the system. For instance, on a Linux system, `cp` is the `/usr/bin/cp` binary. In Nushell, these commands are built-in. This has several advantages:
- They work consistently on platforms where a binary version may not be available (e.g. Windows). This allows the creation of cross-platform scripts, modules, and custom commands.
- They are more tightly integrated with Nushell, allowing them to understand Nushell types and other constructs
- As mentioned in the [Quick Tour](quick_tour.html), they are documented in the Nushell help system. Running `help <command>` or `<command> --help` will display the Nushell documentation for the command.
While the use of the Nushell built-in versions is typically recommended, it is possible to access the Linux binaries. See [Running System Commands](./running_externals.md) for details.