Lesson 3 of 23
Lesson Progress: 0%
The cdcommand stands for "change directory" and is how you move between folders in the Linux shell. When you open a terminal, you start in your home folder, and cd lets you navigate to any other folder on the system. You can move into a subfolder with a name like Documents, go back to the parent folder with cd .., or jump straight to your home folder with cd ~. You can also use full paths like cd /tmp to go anywhere, or use cd - to return to the folder you were just in. Mastering cd is essential because every other command you run depends on being in the right place.
cd is to type it followed by the name of a folder inside your current directory.cd Documents moves you into the Documents folder.cd Documents, the prompt changes to show you are now inside the Documents folder.pwd, which prints the current directory path.cd Documents to move into the Documents folder and see how the prompt changes...means "the parent folder" — the folder that contains the current one.Documents, typing cd .. takes you back to your home folder... levels together like cd ../.. to go up two levels at once... entry exists in every folder and is created automatically by the filesystem.cd .. to move up one level from wherever you are.~is a shortcut that always means "your home folder."cd ~ from anywhere in the filesystem will return you to your home folder./home/user in this simulator.~ is faster than typing the full path /home/user every time.~ with other paths, like ls ~/Documents, to refer to folders inside your home directory./ and describes the full location from the root of the filesystem./tmp is the full path to the temporary files folder, no matter which directory you are currently in.Documents, which only works if Documents exists inside your current folder.cd /tmp to jump directly to the temporary folder using its absolute path.cd to jump directly to any folder on the system.cd /home/user/Documents takes you straight to the Documents folder using its full path from the root./ and work from any location.cd /home/user/Documents to move directly to your Documents folder from anywhere.../var combines the parent shortcut .. with a folder name to navigate./home/user, cd ../var goes up to /home and then into /home/var.cd ../../etc to go up two levels and then into etc.cd ../var to practice moving up one level and then into a different folder.Test Incomplete
~$ cd Documents~$ cd ..~$ cd ../var~$ cd ~~$ cd /tmp~$ cd /home/user/Documents