$ cd foo
$ cd ..

Note in ZSH you can omit cd.

e.g.

$ foo
$ ..
$ cd

Same as:

$ cd ~
$ cd -

e.g.

$ cd foo
$ cd fizz/buzz
$ cd -
$ pwd
foo

Use a number to go back further.

$ cd -NUMBER

e.g.

$ cd abc
$ cd def
$ cd ghi
$ cd -2
$ pwd
abc

See also pushd and popd commands - useful in scripting when navigating into a directory and up again without cd...