Home Linux How to change to the previous working directory on the command line on Linux?
 
 
 

How to change to the previous working directory on the command line on Linux?

PDF Print E-mail

Question: How to change to the previous working directory on the command line on Linux?

 

Answer:

Type in the command below to go to your previous working directory

cd -
or
cd $OLDPWD

Points to remember

  • The "-" is short for previous working directory.
  • The previous working directory is defined by the shell variable $OLDPWD.
  • Everytime you use the cd command it sets the $OLDPWD environment variable.
  • Thus cd $OLDPWD is the same as cd -
+/-
+/- Write comment
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
Security Please input the anti-spam code that you can read in the image.
 

Go Daddy $7.49 .com Sale!