From the course: Learning Zsh

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Directory stack and user dirs

Directory stack and user dirs - Unix Tutorial

From the course: Learning Zsh

Start my 1-month free trial

Directory stack and user dirs

- Earlier, I mentioned that CD with a dash or minus option, switches between the current and recent directories. That's useful for switching back and forth but for a longer list of directories that we might need to switch between, we can use the directory stack. It's a list of recent directories that we can move within and reorder as needed. To view the stack, we can use the dirs built in. I only have my home directory there right now. And we can use pushd and popd to manipulate the stack. Pushd works like CD, except that in addition to changing the working directory to whatever you set it, it also adds that directory to the directory stack. I'll step into a few directories here using pushd. (keys click) Now I'm in ETC. (keys click) And now I'm in VAR. (keys click) Here I am at the root. (keys click) Now, if I type dirs, I can see the stack, the list of directories that I've moved through. I can move between…

Contents