Definition:
cd = change directory
When you want to change the directory from your current location to another using a relative or absolute path, use the cd command.
There are two types of directories: one type you create yourself on the terminal using the mkdir command, and the other type is provided by the system, such as root, home, and default folders.
It is used to navigate between folders in Linux. With the cd command, you can move into a new folder, go back to the parent folder, or directly jump to a system-created directory.
Syntax:
cd [directory_name or path]
Examples:
Move into a folder within the current directory (using a relative path):
cd Documents
You can enter a folder within your current directory (using a relative path).
Move to a subfolder inside Documents (relative path):
cd Documents/Projects
After executing this command, you can move yourself from the present folder into the Documents folder.
After executing this command, you can move to a subfolder inside Documents (relative path).
Go back to the previous directory:
cd ..
Takes you one step back from your current location.
Go directly to the home directory:
cd ~
It brings you to your user’s home folder.
Move using an absolute path:
cd /home/user/Desktop
Moves directly to the Desktop folder from anywhere.
