How to Switch to Previous Directory in Ubuntu
This article provides a quick solution for navigating the Ubuntu terminal by explaining the command used to return to the previous working directory. It covers the exact syntax required, demonstrates a usage example, and highlights how this function improves efficiency during command line operations.
To change the current directory to the previous one, type the following command into your terminal and press Enter:
cd -
This command toggles your location back to the last directory you visited. Upon execution, the terminal prints the absolute path of the previous directory to confirm you have successfully switched. This function saves time by eliminating the need to type out long directory paths when working between two locations.