Changing Location
The cd command (Change Directory) is used to move between directories in the filesystem.
Basic Moves
To move into a directory (using a relative path):
bash $ cd Documents $ pwd /home/user/Documents
To move into a directory using an absolute path:
bash $ cd /etc/network $ pwd /etc/network
Special cd Shortcuts
-
Home Directory (
~): The tilde (~) represents your user's home directory (/home/yourusername). bash $ cd ~Now you are back in /home/yourusername
-
Parent Directory (
..): Two dots represent the directory one level above the current one. bash $ cd ..If you were in /home/user/Documents, you are now in /home/user
-
Root Directory (
/): bash $ cd /Now you are at the very top of the filesystem hierarchy
-
Previous Directory (
-): A hyphen quickly returns you to the directory you were just in. bash $ cd -