I would like to use the recently accessed directories list for logging purposes.
Is the directory stack as used by pushd
and popd
stored somewhere, perhaps as a list of folders in a text file? If so, where?
dirs
is the shell builtin you're looking for, see the man page for bash's implementation:
Display the list of currently remembered directories.
Syntax
dirs [+N | -N] [-clpv]
No, it's just in memory. the source code lies in bash-4.4/builtins/pushd.def: popd_builtin