Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

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.