How to Go Back in Directory in Terminal

In the command prompt window, type cd cd The cd command, also known as chdir (change directory), is a command-line shell command used to change the current working directory in various operating systems . It can be used in shell scripts and batch files. › wiki › Cd_(command) cd (command) - Wikipedia followed by the folder's name you wish to find . This only works for immediate folders straight after the one you're in. If you want to go back one directory, type cd .. to go up a level before typing cd to go back to the original option.

Navigating through directories in the terminal can be a bit confusing, especially when you find yourself in a deep nested directory. If you ever find yourself in such a situation, you might want to go back to a previous directory. In this blog post, we’ll show you how to go back in directory in terminal.

One of the most common things that happen when using the terminal is navigating through directories. However, it can be frustrating when you have to go back all the way to your home directory or a previous directory. This is where the “cd” command comes in handy.

To go back one directory, you need to use the cd command with “dot dot”. When you use “cd” with “dot dot” (..), it takes you back to the previous directory. For instance, if you’re in the directory /cd/virtual machines/ubuntu/something and want to go back to the virtual machines directory, you can use “cd ..”. This will take you back to the virtual machines directory.

If you want to go back to the previous directory again, you can use “cd ..” again. This will take you back to the previous directory. You can continue using “cd ..” to go back as many directories as you want.

On Linux or Mac, you can use two dots instead of one. This means that you can use “cd ../..” to go back two directories. This shortcut can save you a lot of time and make your workflow more efficient.

In conclusion, knowing how to go back in directory in terminal is an essential skill for anyone using the terminal. Using the “cd” command with “dot dot” (..) or two dots (../..) can help you move around directories with ease. So, go ahead and practice navigating through directories and coming back to previous directories using these commands.


How do I go back a directory?
The .. means “the parent directory” of your current directory, so you can use cd .. to go back (or up) one directory. cd ~ (the tilde). The ~ means the home directory, so this command will always change back to your home directory (the default directory in which the Terminal opens).
How do I go back to one directory in Mac Terminal?
If you type cd .. (that's two periods), you'll go to the directory above the one you're currently in. So if you're in your home folder, and type cd .. , you'll go to your Mac's /Users folder. And if you type cd - (hyphen) you'll go back to the directory you were in before the last time you issued the cd command.