cd — Change Directory
cd moves you from one directory to another.
Basic usage
cd documents # Go to the documents directory
cd /etc # Go to /etc (absolute path)
cd ~ # Go to your home directory
cd .. # Go up one level (parent directory)
cd ../.. # Go up two levels
cd - # Go back to previous directory
Navigation shortcuts
| Shortcut | Meaning |
|---|---|
~ | Your home directory |
. | Current directory |
.. | Parent directory |
- | Previous directory |
Tab completion
Press Tab to auto-complete directory names:
cd doc[TAB] → cd documents/
This saves enormous amounts of typing!
Practical examples
pwd # See where you are
cd documents # Enter documents
pwd # Now you're in ~/documents
cd .. # Go back up
pwd # Back in ~