Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is a basic linux question I think, but I really want to know.

For example, currently I am in /usr/bin:

[x@localhost bin]$ pwd
/usr/bin
[x@localhost bin]$ cd /
[x@localhost /]$

Now I want to go back to previous path /usr/bin, how to do that quickly? I don't want to type cd /usr/bin again.

share|improve this question

The command cd - will allow you to quickly return to the last directory.

You may also be interested in the pushd and popd commands which allow even more control over your directory navigation.

share|improve this answer

Depending on the shell you use, there's usually a variable with the previous working directory. In bash, I believe it's $OLDPWD

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.