Definition:
The cd
command stands for Change Directory. It is used to move between folders in Linux.
You can navigate to your own created directories or system-provided directories like root, home, and default folders.
Syntax:
cd [directory_name_or_path]
Example 1: Move into a folder (relative path)
$ cd Documents
Explanation: Moves into the Documents
folder inside the current directory.
Example 2: Move to a subfolder (relative path)
$ cd Documents/Projects
Explanation: Moves into the Projects
subfolder inside Documents
.
Example 3: Go back one directory
$ cd ..
Explanation: Takes you one step back from your current directory.
Example 4: Go directly to home directory
$ cd ~
Explanation: Moves you directly to your user's home folder.
Example 5: Move using absolute path
$ cd /home/user/Desktop
Explanation: Moves directly to the Desktop
folder from anywhere in the system.