Skip to content

how to use DIRSTACK #451

Answered by ajeetdsouza
samyakbardiya asked this question in Q&A
Sep 4, 2022 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

z tries to act like a superset of cd on most shells. In zsh, you can use the pushd and popd commands to create a dirstack, which you can then navigate using these commands. For example:

  • cd -3 goes 3 directories back.
  • cd +2 goes 2 directories forward.

Now, you can do the same thing with z, i.e. z -3 and z +2. The reason for adding this to zsh is so that people who replace their cd command entirely with zoxide (zoxide init zsh --cmd cd) don't lose out on any features from the builtin cd.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@samyakbardiya
Comment options

@martin-braun
Comment options

Answer selected by samyakbardiya
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants