To navigate back to the last directory you were in, type
cd -. This will take you back to where you were before.
cd ~ command will take you back to your home directory.
The user can also use the
cd command by itself to go back to the home directory.
cd .. will take you back one directory.
When editing a command line in bash, use Ctrl-a to go to the start of the command and Ctrl-e to go to the end.