cd Command Generator
Change the working directory (cd [-L|-P] [dir])
Getting Started with cd
## What is cd?
The `cd` command changes the current working directory of your shell. Every subsequent command runs from that location until you `cd` somewhere else. It is one of the most frequently used shell builtins.
## How to Use
1. **Set the Directory**: Enter the path to switch to (e.g., `/var/log`, `..`, `~`). 2. **Choose Mode** (optional): Pick `-L` to follow the logical path (with symlinks) or `-P` to follow the physical filesystem. 3. **Copy & Run**: Paste the generated command into your terminal.
Common Options
### Directory argument
`cd` takes the target path as a positional argument: `cd /var/log`. With no argument, `cd` returns to your home directory (`$HOME`).
### Special targets
- `cd ~` or bare `cd` → home directory. - `cd ..` → parent directory. - `cd -` → previous directory (also prints it). - `cd` with no args → `$HOME`.
### `-L` Logical mode (default)
The path is resolved using `$PWD`, so symbolic links in the current path are preserved. `cd ..` steps back along the logical path you walked.
### `-P` Physical mode
Symlinks are fully resolved to their real filesystem location. Use `-P` when you need the true device path, e.g., `cd -P /symlink`.
▶How do I go back to the previous directory?
▶What is the difference between cd -L and cd -P?
▶How do I jump straight to my home directory?
If this tool has been helpful to you, consider buying me a coffee.
Buy me a coffee