Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I search a wild card name in all subfolders? What would be the equivalent of DOS command: dir *pattern* /s in *nix?

share|improve this question
up vote 16 down vote accepted

You can use find. If, for example, you wanted to find all files and directories that had abcd in the filename, you could run:

find . -name '*abcd*'
share|improve this answer


ls -l **/*abcd*


set -o globstar     # put this line in your ~/.kshrc
ls -l **/*abcd*

Bash ≥4:

shopt -s globstar   # put this line in your ~/.bashrc
ls -l **/*abcd*

Portable (except to very old systems; OpenBSD took a long time but finally supports exec … + since 5.1):

find . -name '*abcd*' -exec ls -l {} +

Not POSIX but works on *BSD, Linux, Cygwin, BusyBox:

find -name '*abcd*' -print0 | xargs -0 ls -l
share|improve this answer
what does shopt -s globstar do?? – user2429920 Mar 5 '15 at 0:23
@user2429920 gnu.org/software/bash/manual/… and click through to gnu.org/software/bash/manual/bash.html#The-Shopt-Builtin then scroll down to globstar. – Gilles Mar 5 '15 at 0:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.