cd
Quick Reference
Command Name:
cd
Category:
file management
Platform:
linux
Basic Usage:
Common Use Cases
- 1
Directory navigation
Change the current working directory
- 2
Path traversal
Navigate through the filesystem hierarchy
- 3
Scripting
Use in shell scripts to change directories programmatically
- 4
File management
Easily access and manipulate files in different directories
Syntax
cd [OPTION] [DIRECTORY]
Options
Option | Description |
---|---|
-L | Follow symbolic links (default behavior) |
-P | Use the physical directory structure without following symbolic links |
-e | If the -P option is supplied, and the current working directory cannot be determined successfully, exit with a non-zero status |
-@ | On systems that support it, present a file with extended attributes as a directory containing the file attributes |
Examples
How to Use These Examples
The examples below show common ways to use the cd
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
# Change to the home directory cd
Advanced Examples:
# Change to the root directory cd /