cd Cheatsheet #
The cd
command is used to change the current working directory in Unix-like operating systems.
Basic Commands #
Command/Option | Example | Description |
---|---|---|
cd /path/to/directory | cd /home/user/documents | Change to the specified directory |
cd ~ | cd ~ | Change to the home directory of the current user |
cd - | cd - | Change to the previous directory |
cd .. | cd .. | Move up one directory level |
cd | cd | Change to the home directory (same as cd ~ ) |
Special Directory Shortcuts #
Command/Option | Example | Description |
---|---|---|
cd / | cd / | Change to the root directory |
cd . | cd . | Stay in the current directory (no change) |
cd ../.. | cd ../.. | Move up two directory levels |
This cheatsheet provides essential cd
commands for navigating the file system.