From the course: Linux Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Browsing with the directory stack

Browsing with the directory stack - Linux Tutorial

From the course: Linux Tips

Browsing with the directory stack

- [Instructor] Usually, we'll move around the file system using the cd command to change directories. And while there's some shortcuts we can use like cd by itself to move to the home directory and cd minus to move to the previously used directory. We can also use the directory stack in Bash and other shells to make navigating between frequently used directories easier. The directory stack is a list of directories that we can manipulate with pushd and popd which you might recognize if you're used to working with stacks in programming. Pushd adds a directory to the stack and popd removes a directory from the list. With either of these operations, the current working directory is changed to whatever directory is at the top of the stack. Starting from my home directory, I'll use pushd to move into the etc directory. I can see the stack with dirs or see the stack with numerical labels by typing dirs-v. I'll keep moving around…

Contents