cd
is the command in Linux to change the current working directory. While you can change to your home directory by cd ~
, you can change to the previous directory or last directory you were in by:
cd -
Which would come very handy when you are working across multiple directories back and forth. To change to the second last directory in the path history, simply add a slash:
cd --