0

I am currently in /downloads directory. Before I was in /var/www directory. How can I return back to the old directory in terminal? I do not want to execute cd /var/www

I need a simple command to change to old directory.

Braiam
  • 69,112

2 Answers2

1

with bash you can use cd - to go to the old directory also known as $OLDPWD

1

cd - : return back to old directory

example:

pwd 

gives

/home/julia/Downloads

Now

cd -

then

pwd

gives

/var/www

cd .. : return back to parent directory

cd ~: go to home directory