What is the βcdβ Command?
The cd
command, an abbreviation for change directory, holds a distinguished position as one of the most fundamental and frequently employed commands in the Linux ecosystem. It serves as the primary means for traversing the intricate directory structure of the Linux file system.
How Does it Work?
cd [Directory]
Directory represents the destination directory you want to navigate to. You can specify either an absolute path or a relative path
- Absolute Path: An absolute path starts from the root directory (β/β) and specifies the full directory hierarchy leading to the target directory.
- Relative Path: A relative path, on the other hand, is specified relative to your current working directory.
Moving to a Specific Directory
cd ~/Documents
Navigating Up One Directory Level
cd ..
Navigating to the Root Directory
cd /
Returning to the Previous Directory
Letβs illustrate this with an example:
- Suppose you start in your home directory (/home/user).
- You navigate to the Documents directory:
cd Documents
# Now you're in /home/user/Documents
- Then, you decide to move to another directory, letβs say dev:
cd dev
# Now you're in /home/user/Documents/dev
- If you want to return to the previous directory which is the Documents directory in this case, you can use the
cd -
command:
cd -
Thank you!
Thank you for your time and for reading this