Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

pushd command adds a directory to a directory stack and change the path to that directory. If i run the commands,

pushd /etc
pushd /usr
pushd /bin

And the output of dirs command is,

/bin /usr /etc ~

Once the current terminal was closed,all the values stored in the directory stack was deleted.Even if i run dirs command on new terminal,it shows nothing..I want the above directory stack to be remain unchanged even if i close the current terminal and reopen a new one.Is that possible?

Any help will be appreciated

share|improve this question
Sure: save the directory stack when exiting bash. But you have to decide what to do when you have multiple shell instances: use the stack from the last-exited instance? Merge the stacks (it's going to look messy pretty fast)? –  Gilles Nov 16 '13 at 22:04

Your Answer


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

Browse other questions tagged or ask your own question.