Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 9
    I think this is the feature I take advantage of most often. Because pushd/popd work independent from cd, you can use them as a more stable bookmark than cd -. Commented Aug 17, 2016 at 15:31
  • for me this is not true. Every time i use cd my stack changes. Commented Apr 4, 2017 at 4:48
  • 2
    oh that was coz of using zsh, when I change to bash, it works fine Commented Apr 4, 2017 at 5:07
  • 7
    This is the only substantive answer as regards a comparison with cd -, IMO. As to whether pushd foo; <random dir changing>; popd is more worthwhile than a=foo; cd $a; <random dir changing>; cd $a ... For scripts I can see a tiny syntactic convenience in the former (pushd), but a massive improvement in clarity in the latter ([explicit] variables!). For an interactive session, I think I would just assume have my directory hierarchy organized properly in the first place, and if I got lost simply cd ~/back/to/obvious/path. Commented Jun 15, 2017 at 18:27
  • 4
    @HarendraSingh you don't happen to have AUTO_PUSHD set? It will make cd behave like pushd, unset it and you'll be back to "normal behaviour". Commented Dec 25, 2019 at 9:28