~/CyberRef$


cd

cd, short for change directory, is crucial to master as it is how you will primarily traverse through your file system!

Tip: cd ~ will always take you back to your home directory, and use quotes "" to navigate to directories with spaces in their names.


Changing Directories

Use cd to swap directories. The syntax is typically: cd pathToDirectory, such as:

cd /var/tmp

The above command would move your terminal into the tmp directory inside of var.

Navigating Up Directories

You may cd .. to "move up" one directory. If we used cd .. after the above example, we would subsequently be in the var directory instead of tmp. You can even move up multiple directories at once:

cd ../..


Straight to the Root

Lastly, you may jump straight to the root of your filesystem with:

cd /

Reference

https://www.commandinline.com/cheat-sheet/cd/