cd CommandcdThe cd command is used to change directories in Linux. The most basic form of the command is:
cd [directory]
This will change the current working directory to the one specified.
cdcd (No Arguments)Returns you to your home directory:
cd
cd .. (Parent Directory)Moves you one level up to the parent directory:
cd ..
cd /path/to/directory (Absolute Path)Navigates to a directory using an absolute path:
cd /home/user/Documents
cd directory_name (Relative Path)Navigates to a directory using a relative path:
cd Documents
cd - (Previous Directory)Switches to the last directory you were in:
cd -
cd ~ (Home Directory)Navigates to your home directory:
cd ~
cd ../.. (Move Two Levels Up)Moves two levels up in the directory structure:
cd ../..
| Option | Description |
|---|---|
cd |
Go to the home directory. |
cd .. |
Go up one directory level. |
cd /path/to/directory |
Go to a directory using an absolute path. |
cd directory_name |
Go to a directory using a relative path. |
cd - |
Go to the previous directory. |
cd ~ |
Go to the home directory (equivalent to cd). |
cd ../.. |
Move two levels up in the directory structure. |
For more detailed information, use the manual page for the cd command:
man cd