From dc7cd178b3111102ffd60b213bbca5629c3148da Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Sat, 2 Feb 2019 18:23:54 -0600 Subject: [PATCH] Update use of cd to be pushd --- unix/list-the-stack-of-remembered-directories.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/unix/list-the-stack-of-remembered-directories.md b/unix/list-the-stack-of-remembered-directories.md index 55f832f..d6a03af 100644 --- a/unix/list-the-stack-of-remembered-directories.md +++ b/unix/list-the-stack-of-remembered-directories.md @@ -1,22 +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. +home (`~/`) directory. If you use `pushd` to navigate 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 +$ pushd code $ dirs ~/code ~/ -$ cd /usr/bin +$ pushd /usr/bin $ dirs /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 to the previous directory, removing the current directory from the stack.