How to Change to the Previous Working Directory in Linux 


               


How to Change to the Previous Working Directory in Linux



Linux


In this article, we show how to change to the previous working directory in linux.

So let's say we are in particular directory and then we want to go back to whatever was the previous working directory.

Let's say, we were in the directory home/david/youtube and then cd to home/david/youtube/Blog/templates

If we want to go back to our previous working directory (home/david/youtube), we can simply specify the following line below.



This will change directory back to the previous working directory, which is /home/david/youtube

This is shown below.

Previous working directory in linux

And that's all there is changing back to the previous working directory.

This directory is unlike cd .., because cd.. goes back one directory (or to the parent directory of the current working directory)>

What cd - does is it goes back to the previous working directory that was the last working directory in the shell.

And this is how we can change to the previous working directory in linux.


Related Resources

How to Randomly Select From or Shuffle a List in Python



HTML Comment Box is loading comments...