cd
file managementlinux
The cd command is one of the most frequently used commands in Linux/Unix-like operating systems. cd The cd command is used to change the current working directory in Linux/Unix systems. cd stands for "change directory" and it's one of the most essential commands for navigating the filesystem.
Quick Reference
Command Name:
cd
Category:
file management
Platform:
linux
Basic Usage:
cd /path/to/directory
Common Use Cases
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.
#
# Change to a specific directory
cd /var/logBasic Examples:
# Change to the home directory cd
Advanced Examples:
# Change to the root directory cd /