Mac Terminal Command to Change Directory
Changing Directories in Mac Terminal
To navigate between folders, you can use the cd (change directory) command in Terminal.
Steps to Change Directory
- Step 1: Open Terminal.
- Step 2: Type
cd [directory]to change to a specific directory. You can use both relative and absolute paths:- Relative path:
cd Documents(navigates to the Documents folder in the current directory). - Absolute path:
cd /Users/username/Documents(navigates to the Documents folder from the root directory).
- Relative path:
- Step 3: To go up one directory, use
cd ... - Step 4: To return to your home directory, use
cd ~or simplycdwithout any arguments.
Understanding the Output
The command pwd will show the current directory after changing directories. The output will look something like this: /Users/username/Documents.
Conclusion
The cd command is fundamental for navigating your file system. Understanding the difference between relative and absolute paths can help you move quickly between directories.