How can I search a wild card name in all subfolders?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












21















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




























    21















    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


























      21












      21








      21


      5






      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
















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







      shell wildcards recursive






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 11 '12 at 23:43









      Gilles

      543k12811001618




      543k12811001618










      asked Sep 11 '12 at 16:08









      Eduard FlorinescuEduard Florinescu

      3,486103956




      3,486103956




















          3 Answers
          3






          active

          oldest

          votes


















          32














          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






























            11














            Zsh:



            ls -ld -- **/*abcd*


            Ksh93:



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


            Bash ≥4:



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


            Yash:



            set -o extendedglob # put this line in your ~/.yashrc
            ls -ld -- **/*abcd*


            tcsh:



            set globstar
            ls -ld -- **/*abcd*


            fish:



            ls -ld -- **abcd*


            (beware some of those shells will follow symlinks when descending the directory tree; some of those that don't like zsh, yash or tcsh have ***/*abcd* to do it).



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



            find . -name '*abcd*' -exec ls -ld +


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



            find . -name '*abcd*' -print0 | xargs -0 ls -ld


            Note that except in some BSDs, if no matching file is found, ls -ld will be run without arguments, so will list .. With some xargs implementations, you can use the -r option to work around that.






            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


















            0














            Not mentioned in the other answers is



            ls -R1 | grep pattern


            ls arguments used:



            -R, --recursive
            list subdirectories recursively
            -1 list one file per line





            share|improve this answer






















              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "106"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f47858%2fhow-can-i-search-a-wild-card-name-in-all-subfolders%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              32














              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



























                32














                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

























                  32












                  32








                  32







                  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













                  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












                  share|improve this answer



                  share|improve this answer










                  answered Sep 11 '12 at 16:11









                  Ryan A.Ryan A.

                  58143




                  58143























                      11














                      Zsh:



                      ls -ld -- **/*abcd*


                      Ksh93:



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


                      Bash ≥4:



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


                      Yash:



                      set -o extendedglob # put this line in your ~/.yashrc
                      ls -ld -- **/*abcd*


                      tcsh:



                      set globstar
                      ls -ld -- **/*abcd*


                      fish:



                      ls -ld -- **abcd*


                      (beware some of those shells will follow symlinks when descending the directory tree; some of those that don't like zsh, yash or tcsh have ***/*abcd* to do it).



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



                      find . -name '*abcd*' -exec ls -ld +


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



                      find . -name '*abcd*' -print0 | xargs -0 ls -ld


                      Note that except in some BSDs, if no matching file is found, ls -ld will be run without arguments, so will list .. With some xargs implementations, you can use the -r option to work around that.






                      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















                      11














                      Zsh:



                      ls -ld -- **/*abcd*


                      Ksh93:



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


                      Bash ≥4:



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


                      Yash:



                      set -o extendedglob # put this line in your ~/.yashrc
                      ls -ld -- **/*abcd*


                      tcsh:



                      set globstar
                      ls -ld -- **/*abcd*


                      fish:



                      ls -ld -- **abcd*


                      (beware some of those shells will follow symlinks when descending the directory tree; some of those that don't like zsh, yash or tcsh have ***/*abcd* to do it).



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



                      find . -name '*abcd*' -exec ls -ld +


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



                      find . -name '*abcd*' -print0 | xargs -0 ls -ld


                      Note that except in some BSDs, if no matching file is found, ls -ld will be run without arguments, so will list .. With some xargs implementations, you can use the -r option to work around that.






                      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













                      11












                      11








                      11







                      Zsh:



                      ls -ld -- **/*abcd*


                      Ksh93:



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


                      Bash ≥4:



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


                      Yash:



                      set -o extendedglob # put this line in your ~/.yashrc
                      ls -ld -- **/*abcd*


                      tcsh:



                      set globstar
                      ls -ld -- **/*abcd*


                      fish:



                      ls -ld -- **abcd*


                      (beware some of those shells will follow symlinks when descending the directory tree; some of those that don't like zsh, yash or tcsh have ***/*abcd* to do it).



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



                      find . -name '*abcd*' -exec ls -ld +


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



                      find . -name '*abcd*' -print0 | xargs -0 ls -ld


                      Note that except in some BSDs, if no matching file is found, ls -ld will be run without arguments, so will list .. With some xargs implementations, you can use the -r option to work around that.






                      share|improve this answer















                      Zsh:



                      ls -ld -- **/*abcd*


                      Ksh93:



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


                      Bash ≥4:



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


                      Yash:



                      set -o extendedglob # put this line in your ~/.yashrc
                      ls -ld -- **/*abcd*


                      tcsh:



                      set globstar
                      ls -ld -- **/*abcd*


                      fish:



                      ls -ld -- **abcd*


                      (beware some of those shells will follow symlinks when descending the directory tree; some of those that don't like zsh, yash or tcsh have ***/*abcd* to do it).



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



                      find . -name '*abcd*' -exec ls -ld +


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



                      find . -name '*abcd*' -print0 | xargs -0 ls -ld


                      Note that except in some BSDs, if no matching file is found, ls -ld will be run without arguments, so will list .. With some xargs implementations, you can use the -r option to work around that.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Feb 24 at 12:53









                      Stéphane Chazelas

                      311k57586945




                      311k57586945










                      answered Sep 12 '12 at 2:04









                      GillesGilles

                      543k12811001618




                      543k12811001618












                      • 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

















                      • 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
















                      what does shopt -s globstar do??

                      – user2429920
                      Mar 5 '15 at 0:23





                      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





                      @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











                      0














                      Not mentioned in the other answers is



                      ls -R1 | grep pattern


                      ls arguments used:



                      -R, --recursive
                      list subdirectories recursively
                      -1 list one file per line





                      share|improve this answer



























                        0














                        Not mentioned in the other answers is



                        ls -R1 | grep pattern


                        ls arguments used:



                        -R, --recursive
                        list subdirectories recursively
                        -1 list one file per line





                        share|improve this answer

























                          0












                          0








                          0







                          Not mentioned in the other answers is



                          ls -R1 | grep pattern


                          ls arguments used:



                          -R, --recursive
                          list subdirectories recursively
                          -1 list one file per line





                          share|improve this answer













                          Not mentioned in the other answers is



                          ls -R1 | grep pattern


                          ls arguments used:



                          -R, --recursive
                          list subdirectories recursively
                          -1 list one file per line






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Feb 24 at 8:25









                          Eduard FlorinescuEduard Florinescu

                          3,486103956




                          3,486103956



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Unix & Linux Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f47858%2fhow-can-i-search-a-wild-card-name-in-all-subfolders%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown






                              Popular posts from this blog

                              How to check contact read email or not when send email to Individual?

                              Bahrain

                              Postfix configuration issue with fips on centos 7; mailgun relay