Use cd .. to go up one level. Use cd - to return to the directory you were in immediately before the current one. Those destinations can be different.

Choose the destination

CommandDestination
cd ..Parent directory
cd ../..Two levels up
cd -Previous working directory
cdYour home directory
pwdShows your current directory; does not move

See the difference

If you move from /tmp to /usr/bin, then cd .. takes you to /usr. By contrast, cd - immediately after that original move would take you back to /tmp. Bash prints the destination when you use cd -.

Remember a sequence of directories

pushd /usr
pushd /
dirs
popd
popd

pushd records a location on a stack; popd returns through it. Quote folder names containing spaces, for example cd "My Projects". If cd - reports that OLDPWD is not set, change to a directory first so Bash has a previous location.

These commands also work in Bash inside Ubuntu on WSL. For leaving the terminal itself, see exiting Git Bash without confusing saved files with commits.

Sources and verification

Directory changes and stack behavior are checked using disposable folders in the local Bash verification run.

Check the directory before running commands

A script in the current folder may need an explicit ./ path; see Bash command lookup. To inspect the filesystem containing your current directory, use the Linux disk-space guide.