What are zsh equivalent to bash's shopt -s globstar and shopt -s dotglob?

I need zsh equivalent to bash‘s shopt -s globstar and shopt -s dotglob. How can I do that?

As per @muru’s answer, I used setopt globdots in the zsh shell, and ran the following command:

for i in INSTALL_USER_FILES/** ; do echo "=> '$i'" ; done

But, the result was only:


And nothing within the .local/ directory was listed recursively?

Asked By: rusty


Recursive globbing is the default in zsh, it doesn’t need to be enabled. The ** glob is simply syntactic sugar here:

A pathname component of the form ‘(foo/)#’ matches a path consisting
of zero or more directories matching the pattern foo.

As a shorthand, ‘**/’ is equivalent to ‘(*/)#’; note that this
therefore matches files in the current directory as well as

The equivalent of dotglob is GLOB_DOTS:


Do not require a leading ‘.’ in a filename to be matched

It can be enabled for an individual glob using the D flag:

% mkdir foo; touch foo/{bar,.bar}; echo foo/*(D)
foo/.bar foo/bar
Answered By: muru
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.