3.1.3. cd - change directories#

  • Use cd (Change Directory) to enter a folder.

cd [folder name]
  • Check your current location with pwd.

pwd
  • To go back one directory, use cd ../. To return to your “home” directory:

cd    # Option 1
cd ~  # Option 2
  • Check your current location again to ensure you’re back home.

pwd

Since bash works in the context of a current directory, you might want to run your command in some other directory. We have cd for changing location:

Change to home directory

cd ~ 

or

cd     

Go back one directory

cd ../

Go to specific directory

cd /home/username/Documents  

Go the the previous directory you were in

cd -