9

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?

3 Answers 3

9

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]

4

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .