-4

I have pushd several pathnames, so my dirs stack has multiple stack frames.

Now I would like to empty the stack, without changing my current directory. I wonder how to do that? Thanks.

  • Read the man page, or help dirs. – Isaac Jan 16 '18 at 11:51
2

Since dirs is a builtin, you can get help for it by running help dirs.

Doing so will inform you about the -c option, which clears your directory stack.

dirs -c
1

For bash:

dirs -c

$ pushd Devel/
~/Devel ~
$ dirs -c
$ dirs
~/Devel
$ pwd
/home/murphy/Devel

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.