2

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?

1

it could be in...

printf %s\\n "${DIRSTACK[@]}" >this_text_file
1

No, it's just in memory. the source code lies in bash-4.4/builtins/pushd.def: popd_builtin

1

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]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.