13

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

12

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]

1
  • Note that this utility isn't available in POSIX Commented May 29 at 13:49
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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.