4

I was just trying to list files in the current directory with a certain pattern, but it doesn't work with hidden files. How can I match all the files?

I tried

ls *foo*

and

ls -a *foo*

Not finding anything in Google, the keywords I can think of to search for this lead to a lot of unrelated informations...

7

Enable globbing for hidden files:

shopt -s dotglob
ls *foo*

Disable:

shopt -u dotglob

Show globbing status:

shopt dotglob
  • 1
    For me, 'shopt dotglob' shows the current value, but 'shopt -p dotglob' doesn't (using bash on Mac OS X). – Henrik Warne Mar 13 '15 at 11:38

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.