mirror of
https://github.com/jbranchaud/til
synced 2026-01-04 23:58:01 +00:00
Update use of cd to be pushd
This commit is contained in:
@@ -1,22 +1,23 @@
|
|||||||
# List The Stack Of Remembered Directories
|
# List The Stack Of Remembered Directories
|
||||||
|
|
||||||
When you open a new Unix shell, you start in some directory, probably your
|
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
|
home (`~/`) directory. If you use `pushd` to navigate to different
|
||||||
a paper trail of your movements, a listing of where you've been. You can
|
directories, there is a paper trail of your movements, a listing of where
|
||||||
view this listing of directories with the `dirs` command.
|
you've been. You can view this listing of directories with the `dirs`
|
||||||
|
command.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ dirs
|
$ dirs
|
||||||
~/
|
~/
|
||||||
$ cd code
|
$ pushd code
|
||||||
$ dirs
|
$ dirs
|
||||||
~/code ~/
|
~/code ~/
|
||||||
$ cd /usr/bin
|
$ pushd /usr/bin
|
||||||
$ dirs
|
$ dirs
|
||||||
/usr/bin ~/code ~/
|
/usr/bin ~/code ~/
|
||||||
```
|
```
|
||||||
|
|
||||||
Each time you `cd`, the directory you have moved to is pushed onto the stack of
|
Each time you `pushd`, the directory you have moved to is pushed onto the stack of
|
||||||
visited directories. Alternatively, you can use the `popd` command to return
|
visited directories. Alternatively, you can use the `popd` command to return
|
||||||
to the previous directory, removing the current directory from the stack.
|
to the previous directory, removing the current directory from the stack.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user