how to force find to recursively search subdirectories

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











up vote
0
down vote

favorite












I run this command



find -iname *something*


It normally searches in subfolders but if I have a file that matches the criteria in the working directory it only reports it and stops.
I'm thinking to write a function that first searches sub folders in current directory than issue many find commands for each of them but I feel there should be an easier way... Actually I think it should be the default behavior, so maybe I have something wrong in some setup file?










share|improve this question



















  • 2




    do you have it aliased or hidden with a function? alias find and declare -f find output would clarify the situation
    – Jeff Schaller
    Aug 26 '16 at 17:51







  • 1




    What happens when you add a dot after find - find . -iname something ?
    – fd0
    Aug 26 '16 at 17:53














up vote
0
down vote

favorite












I run this command



find -iname *something*


It normally searches in subfolders but if I have a file that matches the criteria in the working directory it only reports it and stops.
I'm thinking to write a function that first searches sub folders in current directory than issue many find commands for each of them but I feel there should be an easier way... Actually I think it should be the default behavior, so maybe I have something wrong in some setup file?










share|improve this question



















  • 2




    do you have it aliased or hidden with a function? alias find and declare -f find output would clarify the situation
    – Jeff Schaller
    Aug 26 '16 at 17:51







  • 1




    What happens when you add a dot after find - find . -iname something ?
    – fd0
    Aug 26 '16 at 17:53












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I run this command



find -iname *something*


It normally searches in subfolders but if I have a file that matches the criteria in the working directory it only reports it and stops.
I'm thinking to write a function that first searches sub folders in current directory than issue many find commands for each of them but I feel there should be an easier way... Actually I think it should be the default behavior, so maybe I have something wrong in some setup file?










share|improve this question















I run this command



find -iname *something*


It normally searches in subfolders but if I have a file that matches the criteria in the working directory it only reports it and stops.
I'm thinking to write a function that first searches sub folders in current directory than issue many find commands for each of them but I feel there should be an easier way... Actually I think it should be the default behavior, so maybe I have something wrong in some setup file?







find






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 26 '16 at 22:28









Gilles

518k12410341563




518k12410341563










asked Aug 26 '16 at 17:48









user186728

1




1







  • 2




    do you have it aliased or hidden with a function? alias find and declare -f find output would clarify the situation
    – Jeff Schaller
    Aug 26 '16 at 17:51







  • 1




    What happens when you add a dot after find - find . -iname something ?
    – fd0
    Aug 26 '16 at 17:53












  • 2




    do you have it aliased or hidden with a function? alias find and declare -f find output would clarify the situation
    – Jeff Schaller
    Aug 26 '16 at 17:51







  • 1




    What happens when you add a dot after find - find . -iname something ?
    – fd0
    Aug 26 '16 at 17:53







2




2




do you have it aliased or hidden with a function? alias find and declare -f find output would clarify the situation
– Jeff Schaller
Aug 26 '16 at 17:51





do you have it aliased or hidden with a function? alias find and declare -f find output would clarify the situation
– Jeff Schaller
Aug 26 '16 at 17:51





1




1




What happens when you add a dot after find - find . -iname something ?
– fd0
Aug 26 '16 at 17:53




What happens when you add a dot after find - find . -iname something ?
– fd0
Aug 26 '16 at 17:53










2 Answers
2






active

oldest

votes

















up vote
5
down vote













Does something include a glob that is being interpreted by the shell? That would cause the expanded filename to be passed to the find command.



For example if you run find -iname *.txt with a file in the current directory called file.txt then the resulting command after shell expansion would be find -iname file.txt.



To avoid this pitfall you can escape the glob to send the literal string to the find command with find -iname '*.txt'






share|improve this answer



























    up vote
    0
    down vote













    If the subfolders are behind symbolic links you have to use the -L option. Try



    find -L -iname *something*


    According to find man pages




    If -L is in effect and find discovers a symbolic link to a subdirectory during its search, the subdirectory pointed to by the symbolic link will be searched.







    share|improve this answer








    New contributor




    user9114986 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.

















      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',
      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%2f305964%2fhow-to-force-find-to-recursively-search-subdirectories%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      5
      down vote













      Does something include a glob that is being interpreted by the shell? That would cause the expanded filename to be passed to the find command.



      For example if you run find -iname *.txt with a file in the current directory called file.txt then the resulting command after shell expansion would be find -iname file.txt.



      To avoid this pitfall you can escape the glob to send the literal string to the find command with find -iname '*.txt'






      share|improve this answer
























        up vote
        5
        down vote













        Does something include a glob that is being interpreted by the shell? That would cause the expanded filename to be passed to the find command.



        For example if you run find -iname *.txt with a file in the current directory called file.txt then the resulting command after shell expansion would be find -iname file.txt.



        To avoid this pitfall you can escape the glob to send the literal string to the find command with find -iname '*.txt'






        share|improve this answer






















          up vote
          5
          down vote










          up vote
          5
          down vote









          Does something include a glob that is being interpreted by the shell? That would cause the expanded filename to be passed to the find command.



          For example if you run find -iname *.txt with a file in the current directory called file.txt then the resulting command after shell expansion would be find -iname file.txt.



          To avoid this pitfall you can escape the glob to send the literal string to the find command with find -iname '*.txt'






          share|improve this answer












          Does something include a glob that is being interpreted by the shell? That would cause the expanded filename to be passed to the find command.



          For example if you run find -iname *.txt with a file in the current directory called file.txt then the resulting command after shell expansion would be find -iname file.txt.



          To avoid this pitfall you can escape the glob to send the literal string to the find command with find -iname '*.txt'







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 26 '16 at 18:54









          Jesusaurus

          31917




          31917






















              up vote
              0
              down vote













              If the subfolders are behind symbolic links you have to use the -L option. Try



              find -L -iname *something*


              According to find man pages




              If -L is in effect and find discovers a symbolic link to a subdirectory during its search, the subdirectory pointed to by the symbolic link will be searched.







              share|improve this answer








              New contributor




              user9114986 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.





















                up vote
                0
                down vote













                If the subfolders are behind symbolic links you have to use the -L option. Try



                find -L -iname *something*


                According to find man pages




                If -L is in effect and find discovers a symbolic link to a subdirectory during its search, the subdirectory pointed to by the symbolic link will be searched.







                share|improve this answer








                New contributor




                user9114986 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.



















                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  If the subfolders are behind symbolic links you have to use the -L option. Try



                  find -L -iname *something*


                  According to find man pages




                  If -L is in effect and find discovers a symbolic link to a subdirectory during its search, the subdirectory pointed to by the symbolic link will be searched.







                  share|improve this answer








                  New contributor




                  user9114986 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  If the subfolders are behind symbolic links you have to use the -L option. Try



                  find -L -iname *something*


                  According to find man pages




                  If -L is in effect and find discovers a symbolic link to a subdirectory during its search, the subdirectory pointed to by the symbolic link will be searched.








                  share|improve this answer








                  New contributor




                  user9114986 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  share|improve this answer



                  share|improve this answer






                  New contributor




                  user9114986 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  answered 24 mins ago









                  user9114986

                  1




                  1




                  New contributor




                  user9114986 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.





                  New contributor





                  user9114986 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






                  user9114986 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f305964%2fhow-to-force-find-to-recursively-search-subdirectories%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      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