1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-04 23:58:01 +00:00

Add List The Stack Of Remembered Directories as a unix til

This commit is contained in:
jbranchaud
2019-02-01 14:49:15 -06:00
parent d876b7a1bf
commit 3e1f4afb89
2 changed files with 25 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
# List The Stack Of Remembered Directories
When you open a new Unix shell, you start in some directory, probably your
home (`~/`) directory. As you `cd` around to different directories, there is
a paper trail of your movements, a listing of where you've been. You can
view this listing of directories with the `dirs` command.
```
$ dirs
~/
$ cd code
$ dirs
~/code ~/
$ cd /usr/bin
$ dirs
/usr/bin ~/code ~/
```
Each time you `cd`, the directory you have moved to is pushed onto the stack of
visited directories. Alternatively, you can use the `popd` command to return
to the previous directory, removing the current directory from the stack.
[source](http://www.gnu.org/software/bash/manual/html_node/Directory-Stack-Builtins.html#Directory-Stack-Builtins)