课程: Linux Tips

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Browsing with the directory stack

Browsing with the directory stack - Linux教程

课程: 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…

内容