cdaround like you normally would, and the directories are pushed into a stack. Use the function
sto view the stack of directories, and run
cdinto the directory listed. Use
bto jump back 1 directory.
I was inspired by this article written by Derek Wyatt about directory
management in BASH. The code I’ve written for this accomplishes most of the same tasks,
but does so with about 1/3 of the code, as this was written specifically for BASH (no
legacy KSH bits) and doesn’t implement any of the fancier features for
In the above example I
cd around a bit, and then run
s to see what the current
stack looks like. The current stacks shows all of my previous directories in reverse order
$CD_STACK_MAX entries, which defaults to 15).
The code is on GitHub here https://github.com/bahamas10/bash-cdstack