What is the difference between find . and find . -print











up vote
24
down vote

favorite
6












What is the difference between:



find .


and



find . -print


What does -print actually do?



$ find .
.
./hello.txt
./hello
./hello/txt
./hello/hello2
./hello/hello2/hello3
./hello/hello2/hello3/txt
./hello/hello2/txt
$ find . -print
.
./hello.txt
./hello
./hello/txt
./hello/hello2
./hello/hello2/hello3
./hello/hello2/hello3/txt
./hello/hello2/txt









share|improve this question




























    up vote
    24
    down vote

    favorite
    6












    What is the difference between:



    find .


    and



    find . -print


    What does -print actually do?



    $ find .
    .
    ./hello.txt
    ./hello
    ./hello/txt
    ./hello/hello2
    ./hello/hello2/hello3
    ./hello/hello2/hello3/txt
    ./hello/hello2/txt
    $ find . -print
    .
    ./hello.txt
    ./hello
    ./hello/txt
    ./hello/hello2
    ./hello/hello2/hello3
    ./hello/hello2/hello3/txt
    ./hello/hello2/txt









    share|improve this question


























      up vote
      24
      down vote

      favorite
      6









      up vote
      24
      down vote

      favorite
      6






      6





      What is the difference between:



      find .


      and



      find . -print


      What does -print actually do?



      $ find .
      .
      ./hello.txt
      ./hello
      ./hello/txt
      ./hello/hello2
      ./hello/hello2/hello3
      ./hello/hello2/hello3/txt
      ./hello/hello2/txt
      $ find . -print
      .
      ./hello.txt
      ./hello
      ./hello/txt
      ./hello/hello2
      ./hello/hello2/hello3
      ./hello/hello2/hello3/txt
      ./hello/hello2/txt









      share|improve this question















      What is the difference between:



      find .


      and



      find . -print


      What does -print actually do?



      $ find .
      .
      ./hello.txt
      ./hello
      ./hello/txt
      ./hello/hello2
      ./hello/hello2/hello3
      ./hello/hello2/hello3/txt
      ./hello/hello2/txt
      $ find . -print
      .
      ./hello.txt
      ./hello
      ./hello/txt
      ./hello/hello2
      ./hello/hello2/hello3
      ./hello/hello2/hello3/txt
      ./hello/hello2/txt






      command-line find






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 22 '15 at 9:45









      Stéphane Chazelas

      296k54559904




      296k54559904










      asked Apr 22 '15 at 8:19









      faressoft

      303129




      303129






















          6 Answers
          6






          active

          oldest

          votes

















          up vote
          38
          down vote



          accepted










          From the findutils find manpage:




          If no expression is given, the expression -print is used (but you should probably consider using -print0 instead, anyway).




          (-print is a find expression.)



          The POSIX documentation confirms this:




          If no expression is present, -print shall be used as the expression.




          So find . is exactly equivalent to find . -print; the first has no expression so -print is added internally.



          The explanation of what -print does comes further down in the manpage:




          -print



          True; print the full file name on the standard output, followed by a newline. If you are piping the output of find into another program and there is the faintest possibility that the files which you are searching for might contain a newline, then you should seriously consider using the -print0 option instead of -print. See the UNUSUAL FILENAMES section for information about how unusual characters in filenames are handled.







          share|improve this answer























          • Sort of beginner level question but what's this expression you are talkng about? is this regular expression?
            – Rishi Prakash
            Apr 20 '17 at 14:33






          • 2




            @Rishi see the manpage.
            – Stephen Kitt
            Apr 20 '17 at 14:35


















          up vote
          19
          down vote













          -print is the default action. Some find predicates are considered as actions as opposed to filters or conditions. For instance, -type f is not an action. -exec is an action even though it can also be used as a condition.



          Actions include -print, -exec and -ok. Some find implementations have other non-standard action predicates like the -print0, -printf, -execdir, -okdir, -ls...



          find files <some-predicates>


          Where none of <some-predicates> contain actions is equivalent to:



          find files ( <some-predicates> ) -print


          (note the parentheses above which are important if there are some -o operators).



          When in doubt, best is to use -print explicitly (or -exec printf '%s' {} + (or -print0 where available) so that output can be post-processed).



          The default -print action is specified by POSIX. Some old find implementations required an explicit -print, but those are usually not found in the wild nowadays.



          Also note that some find implementations allow omitting the files, in which case they default to searching into the current directory. That is, for them,



          find


          is equivalent to



          find .
          find . -print


          That is however not standard, so is best avoided.



          On the more verbose (and useful) end of the spectrum, some find implementations also allow passing file paths as argument to a -f option as in:



          find -f "$file1" -f "$file2" -print


          They are the only find implementations that allow passing arbitrary file paths to find. Other implementations cannot accept file paths like ! or -print... so find "$file" -print (or even find -- "$file" -print) assumes $file is not the name of a find predicate (or option in the first case).



          Unfortunately that's not standard nor portable either.






          share|improve this answer























          • If it is non-standard and is best avoided why name it at all?
            – Isaac
            Nov 27 at 22:19










          • @Isaac, because they can be handy/are possible typos...
            – vonbrand
            Nov 28 at 0:31


















          up vote
          7
          down vote













          They are the same, they both write out the entire directory hierarchy from the current directory.



          From POSIX find documentation:




          The following commands are equivalent:



          find .



          find . -print







          share|improve this answer






























            up vote
            3
            down vote













            In Linux there is no difference, but other systems (like AIX for instance) need -print if you want the output of the command displayed on your screen.






            share|improve this answer

















            • 3




              That would be very very old versions of AIX then. AIX 4.3 find doesn't need it. AIX has been POSIX conformant for decades.
              – Stéphane Chazelas
              Apr 22 '15 at 9:13




















            up vote
            2
            down vote













            For many years the find command did not have a default action. A common error was forgetting to add the -print option to your find command. I still to this day type it out of habit.



            But at some point it was added as the default action so now find . and find . -print are equivalent.






            share|improve this answer




























              up vote
              0
              down vote













              It is sometimes useful to use -print explicitly when you are performing another action so the filename is displayed as that action is performed.



              find . -print -delete


              would be similar to



              rm -rfv *


              where -print corresponds to -v. If you don't include -print then the filenames aren't displayed.



              In order to make the rm command even more similar, by the way, issue this Bash command first



              shopt -s dotglob


              which will make the * match dot (hidden) files.






              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',
                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%2f197824%2fwhat-is-the-difference-between-find-and-find-print%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                6 Answers
                6






                active

                oldest

                votes








                6 Answers
                6






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                38
                down vote



                accepted










                From the findutils find manpage:




                If no expression is given, the expression -print is used (but you should probably consider using -print0 instead, anyway).




                (-print is a find expression.)



                The POSIX documentation confirms this:




                If no expression is present, -print shall be used as the expression.




                So find . is exactly equivalent to find . -print; the first has no expression so -print is added internally.



                The explanation of what -print does comes further down in the manpage:




                -print



                True; print the full file name on the standard output, followed by a newline. If you are piping the output of find into another program and there is the faintest possibility that the files which you are searching for might contain a newline, then you should seriously consider using the -print0 option instead of -print. See the UNUSUAL FILENAMES section for information about how unusual characters in filenames are handled.







                share|improve this answer























                • Sort of beginner level question but what's this expression you are talkng about? is this regular expression?
                  – Rishi Prakash
                  Apr 20 '17 at 14:33






                • 2




                  @Rishi see the manpage.
                  – Stephen Kitt
                  Apr 20 '17 at 14:35















                up vote
                38
                down vote



                accepted










                From the findutils find manpage:




                If no expression is given, the expression -print is used (but you should probably consider using -print0 instead, anyway).




                (-print is a find expression.)



                The POSIX documentation confirms this:




                If no expression is present, -print shall be used as the expression.




                So find . is exactly equivalent to find . -print; the first has no expression so -print is added internally.



                The explanation of what -print does comes further down in the manpage:




                -print



                True; print the full file name on the standard output, followed by a newline. If you are piping the output of find into another program and there is the faintest possibility that the files which you are searching for might contain a newline, then you should seriously consider using the -print0 option instead of -print. See the UNUSUAL FILENAMES section for information about how unusual characters in filenames are handled.







                share|improve this answer























                • Sort of beginner level question but what's this expression you are talkng about? is this regular expression?
                  – Rishi Prakash
                  Apr 20 '17 at 14:33






                • 2




                  @Rishi see the manpage.
                  – Stephen Kitt
                  Apr 20 '17 at 14:35













                up vote
                38
                down vote



                accepted







                up vote
                38
                down vote



                accepted






                From the findutils find manpage:




                If no expression is given, the expression -print is used (but you should probably consider using -print0 instead, anyway).




                (-print is a find expression.)



                The POSIX documentation confirms this:




                If no expression is present, -print shall be used as the expression.




                So find . is exactly equivalent to find . -print; the first has no expression so -print is added internally.



                The explanation of what -print does comes further down in the manpage:




                -print



                True; print the full file name on the standard output, followed by a newline. If you are piping the output of find into another program and there is the faintest possibility that the files which you are searching for might contain a newline, then you should seriously consider using the -print0 option instead of -print. See the UNUSUAL FILENAMES section for information about how unusual characters in filenames are handled.







                share|improve this answer














                From the findutils find manpage:




                If no expression is given, the expression -print is used (but you should probably consider using -print0 instead, anyway).




                (-print is a find expression.)



                The POSIX documentation confirms this:




                If no expression is present, -print shall be used as the expression.




                So find . is exactly equivalent to find . -print; the first has no expression so -print is added internally.



                The explanation of what -print does comes further down in the manpage:




                -print



                True; print the full file name on the standard output, followed by a newline. If you are piping the output of find into another program and there is the faintest possibility that the files which you are searching for might contain a newline, then you should seriously consider using the -print0 option instead of -print. See the UNUSUAL FILENAMES section for information about how unusual characters in filenames are handled.








                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Apr 22 '15 at 8:55

























                answered Apr 22 '15 at 8:29









                Stephen Kitt

                160k24357432




                160k24357432












                • Sort of beginner level question but what's this expression you are talkng about? is this regular expression?
                  – Rishi Prakash
                  Apr 20 '17 at 14:33






                • 2




                  @Rishi see the manpage.
                  – Stephen Kitt
                  Apr 20 '17 at 14:35


















                • Sort of beginner level question but what's this expression you are talkng about? is this regular expression?
                  – Rishi Prakash
                  Apr 20 '17 at 14:33






                • 2




                  @Rishi see the manpage.
                  – Stephen Kitt
                  Apr 20 '17 at 14:35
















                Sort of beginner level question but what's this expression you are talkng about? is this regular expression?
                – Rishi Prakash
                Apr 20 '17 at 14:33




                Sort of beginner level question but what's this expression you are talkng about? is this regular expression?
                – Rishi Prakash
                Apr 20 '17 at 14:33




                2




                2




                @Rishi see the manpage.
                – Stephen Kitt
                Apr 20 '17 at 14:35




                @Rishi see the manpage.
                – Stephen Kitt
                Apr 20 '17 at 14:35












                up vote
                19
                down vote













                -print is the default action. Some find predicates are considered as actions as opposed to filters or conditions. For instance, -type f is not an action. -exec is an action even though it can also be used as a condition.



                Actions include -print, -exec and -ok. Some find implementations have other non-standard action predicates like the -print0, -printf, -execdir, -okdir, -ls...



                find files <some-predicates>


                Where none of <some-predicates> contain actions is equivalent to:



                find files ( <some-predicates> ) -print


                (note the parentheses above which are important if there are some -o operators).



                When in doubt, best is to use -print explicitly (or -exec printf '%s' {} + (or -print0 where available) so that output can be post-processed).



                The default -print action is specified by POSIX. Some old find implementations required an explicit -print, but those are usually not found in the wild nowadays.



                Also note that some find implementations allow omitting the files, in which case they default to searching into the current directory. That is, for them,



                find


                is equivalent to



                find .
                find . -print


                That is however not standard, so is best avoided.



                On the more verbose (and useful) end of the spectrum, some find implementations also allow passing file paths as argument to a -f option as in:



                find -f "$file1" -f "$file2" -print


                They are the only find implementations that allow passing arbitrary file paths to find. Other implementations cannot accept file paths like ! or -print... so find "$file" -print (or even find -- "$file" -print) assumes $file is not the name of a find predicate (or option in the first case).



                Unfortunately that's not standard nor portable either.






                share|improve this answer























                • If it is non-standard and is best avoided why name it at all?
                  – Isaac
                  Nov 27 at 22:19










                • @Isaac, because they can be handy/are possible typos...
                  – vonbrand
                  Nov 28 at 0:31















                up vote
                19
                down vote













                -print is the default action. Some find predicates are considered as actions as opposed to filters or conditions. For instance, -type f is not an action. -exec is an action even though it can also be used as a condition.



                Actions include -print, -exec and -ok. Some find implementations have other non-standard action predicates like the -print0, -printf, -execdir, -okdir, -ls...



                find files <some-predicates>


                Where none of <some-predicates> contain actions is equivalent to:



                find files ( <some-predicates> ) -print


                (note the parentheses above which are important if there are some -o operators).



                When in doubt, best is to use -print explicitly (or -exec printf '%s' {} + (or -print0 where available) so that output can be post-processed).



                The default -print action is specified by POSIX. Some old find implementations required an explicit -print, but those are usually not found in the wild nowadays.



                Also note that some find implementations allow omitting the files, in which case they default to searching into the current directory. That is, for them,



                find


                is equivalent to



                find .
                find . -print


                That is however not standard, so is best avoided.



                On the more verbose (and useful) end of the spectrum, some find implementations also allow passing file paths as argument to a -f option as in:



                find -f "$file1" -f "$file2" -print


                They are the only find implementations that allow passing arbitrary file paths to find. Other implementations cannot accept file paths like ! or -print... so find "$file" -print (or even find -- "$file" -print) assumes $file is not the name of a find predicate (or option in the first case).



                Unfortunately that's not standard nor portable either.






                share|improve this answer























                • If it is non-standard and is best avoided why name it at all?
                  – Isaac
                  Nov 27 at 22:19










                • @Isaac, because they can be handy/are possible typos...
                  – vonbrand
                  Nov 28 at 0:31













                up vote
                19
                down vote










                up vote
                19
                down vote









                -print is the default action. Some find predicates are considered as actions as opposed to filters or conditions. For instance, -type f is not an action. -exec is an action even though it can also be used as a condition.



                Actions include -print, -exec and -ok. Some find implementations have other non-standard action predicates like the -print0, -printf, -execdir, -okdir, -ls...



                find files <some-predicates>


                Where none of <some-predicates> contain actions is equivalent to:



                find files ( <some-predicates> ) -print


                (note the parentheses above which are important if there are some -o operators).



                When in doubt, best is to use -print explicitly (or -exec printf '%s' {} + (or -print0 where available) so that output can be post-processed).



                The default -print action is specified by POSIX. Some old find implementations required an explicit -print, but those are usually not found in the wild nowadays.



                Also note that some find implementations allow omitting the files, in which case they default to searching into the current directory. That is, for them,



                find


                is equivalent to



                find .
                find . -print


                That is however not standard, so is best avoided.



                On the more verbose (and useful) end of the spectrum, some find implementations also allow passing file paths as argument to a -f option as in:



                find -f "$file1" -f "$file2" -print


                They are the only find implementations that allow passing arbitrary file paths to find. Other implementations cannot accept file paths like ! or -print... so find "$file" -print (or even find -- "$file" -print) assumes $file is not the name of a find predicate (or option in the first case).



                Unfortunately that's not standard nor portable either.






                share|improve this answer














                -print is the default action. Some find predicates are considered as actions as opposed to filters or conditions. For instance, -type f is not an action. -exec is an action even though it can also be used as a condition.



                Actions include -print, -exec and -ok. Some find implementations have other non-standard action predicates like the -print0, -printf, -execdir, -okdir, -ls...



                find files <some-predicates>


                Where none of <some-predicates> contain actions is equivalent to:



                find files ( <some-predicates> ) -print


                (note the parentheses above which are important if there are some -o operators).



                When in doubt, best is to use -print explicitly (or -exec printf '%s' {} + (or -print0 where available) so that output can be post-processed).



                The default -print action is specified by POSIX. Some old find implementations required an explicit -print, but those are usually not found in the wild nowadays.



                Also note that some find implementations allow omitting the files, in which case they default to searching into the current directory. That is, for them,



                find


                is equivalent to



                find .
                find . -print


                That is however not standard, so is best avoided.



                On the more verbose (and useful) end of the spectrum, some find implementations also allow passing file paths as argument to a -f option as in:



                find -f "$file1" -f "$file2" -print


                They are the only find implementations that allow passing arbitrary file paths to find. Other implementations cannot accept file paths like ! or -print... so find "$file" -print (or even find -- "$file" -print) assumes $file is not the name of a find predicate (or option in the first case).



                Unfortunately that's not standard nor portable either.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 28 at 8:30

























                answered Apr 22 '15 at 9:06









                Stéphane Chazelas

                296k54559904




                296k54559904












                • If it is non-standard and is best avoided why name it at all?
                  – Isaac
                  Nov 27 at 22:19










                • @Isaac, because they can be handy/are possible typos...
                  – vonbrand
                  Nov 28 at 0:31


















                • If it is non-standard and is best avoided why name it at all?
                  – Isaac
                  Nov 27 at 22:19










                • @Isaac, because they can be handy/are possible typos...
                  – vonbrand
                  Nov 28 at 0:31
















                If it is non-standard and is best avoided why name it at all?
                – Isaac
                Nov 27 at 22:19




                If it is non-standard and is best avoided why name it at all?
                – Isaac
                Nov 27 at 22:19












                @Isaac, because they can be handy/are possible typos...
                – vonbrand
                Nov 28 at 0:31




                @Isaac, because they can be handy/are possible typos...
                – vonbrand
                Nov 28 at 0:31










                up vote
                7
                down vote













                They are the same, they both write out the entire directory hierarchy from the current directory.



                From POSIX find documentation:




                The following commands are equivalent:



                find .



                find . -print







                share|improve this answer



























                  up vote
                  7
                  down vote













                  They are the same, they both write out the entire directory hierarchy from the current directory.



                  From POSIX find documentation:




                  The following commands are equivalent:



                  find .



                  find . -print







                  share|improve this answer

























                    up vote
                    7
                    down vote










                    up vote
                    7
                    down vote









                    They are the same, they both write out the entire directory hierarchy from the current directory.



                    From POSIX find documentation:




                    The following commands are equivalent:



                    find .



                    find . -print







                    share|improve this answer














                    They are the same, they both write out the entire directory hierarchy from the current directory.



                    From POSIX find documentation:




                    The following commands are equivalent:



                    find .



                    find . -print








                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Apr 22 '15 at 8:59

























                    answered Apr 22 '15 at 8:26









                    cuonglm

                    101k23197299




                    101k23197299






















                        up vote
                        3
                        down vote













                        In Linux there is no difference, but other systems (like AIX for instance) need -print if you want the output of the command displayed on your screen.






                        share|improve this answer

















                        • 3




                          That would be very very old versions of AIX then. AIX 4.3 find doesn't need it. AIX has been POSIX conformant for decades.
                          – Stéphane Chazelas
                          Apr 22 '15 at 9:13

















                        up vote
                        3
                        down vote













                        In Linux there is no difference, but other systems (like AIX for instance) need -print if you want the output of the command displayed on your screen.






                        share|improve this answer

















                        • 3




                          That would be very very old versions of AIX then. AIX 4.3 find doesn't need it. AIX has been POSIX conformant for decades.
                          – Stéphane Chazelas
                          Apr 22 '15 at 9:13















                        up vote
                        3
                        down vote










                        up vote
                        3
                        down vote









                        In Linux there is no difference, but other systems (like AIX for instance) need -print if you want the output of the command displayed on your screen.






                        share|improve this answer












                        In Linux there is no difference, but other systems (like AIX for instance) need -print if you want the output of the command displayed on your screen.







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Apr 22 '15 at 8:43









                        YoMismo

                        3,0561724




                        3,0561724








                        • 3




                          That would be very very old versions of AIX then. AIX 4.3 find doesn't need it. AIX has been POSIX conformant for decades.
                          – Stéphane Chazelas
                          Apr 22 '15 at 9:13
















                        • 3




                          That would be very very old versions of AIX then. AIX 4.3 find doesn't need it. AIX has been POSIX conformant for decades.
                          – Stéphane Chazelas
                          Apr 22 '15 at 9:13










                        3




                        3




                        That would be very very old versions of AIX then. AIX 4.3 find doesn't need it. AIX has been POSIX conformant for decades.
                        – Stéphane Chazelas
                        Apr 22 '15 at 9:13






                        That would be very very old versions of AIX then. AIX 4.3 find doesn't need it. AIX has been POSIX conformant for decades.
                        – Stéphane Chazelas
                        Apr 22 '15 at 9:13












                        up vote
                        2
                        down vote













                        For many years the find command did not have a default action. A common error was forgetting to add the -print option to your find command. I still to this day type it out of habit.



                        But at some point it was added as the default action so now find . and find . -print are equivalent.






                        share|improve this answer

























                          up vote
                          2
                          down vote













                          For many years the find command did not have a default action. A common error was forgetting to add the -print option to your find command. I still to this day type it out of habit.



                          But at some point it was added as the default action so now find . and find . -print are equivalent.






                          share|improve this answer























                            up vote
                            2
                            down vote










                            up vote
                            2
                            down vote









                            For many years the find command did not have a default action. A common error was forgetting to add the -print option to your find command. I still to this day type it out of habit.



                            But at some point it was added as the default action so now find . and find . -print are equivalent.






                            share|improve this answer












                            For many years the find command did not have a default action. A common error was forgetting to add the -print option to your find command. I still to this day type it out of habit.



                            But at some point it was added as the default action so now find . and find . -print are equivalent.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Apr 22 '15 at 16:59









                            Kevin

                            211




                            211






















                                up vote
                                0
                                down vote













                                It is sometimes useful to use -print explicitly when you are performing another action so the filename is displayed as that action is performed.



                                find . -print -delete


                                would be similar to



                                rm -rfv *


                                where -print corresponds to -v. If you don't include -print then the filenames aren't displayed.



                                In order to make the rm command even more similar, by the way, issue this Bash command first



                                shopt -s dotglob


                                which will make the * match dot (hidden) files.






                                share|improve this answer

























                                  up vote
                                  0
                                  down vote













                                  It is sometimes useful to use -print explicitly when you are performing another action so the filename is displayed as that action is performed.



                                  find . -print -delete


                                  would be similar to



                                  rm -rfv *


                                  where -print corresponds to -v. If you don't include -print then the filenames aren't displayed.



                                  In order to make the rm command even more similar, by the way, issue this Bash command first



                                  shopt -s dotglob


                                  which will make the * match dot (hidden) files.






                                  share|improve this answer























                                    up vote
                                    0
                                    down vote










                                    up vote
                                    0
                                    down vote









                                    It is sometimes useful to use -print explicitly when you are performing another action so the filename is displayed as that action is performed.



                                    find . -print -delete


                                    would be similar to



                                    rm -rfv *


                                    where -print corresponds to -v. If you don't include -print then the filenames aren't displayed.



                                    In order to make the rm command even more similar, by the way, issue this Bash command first



                                    shopt -s dotglob


                                    which will make the * match dot (hidden) files.






                                    share|improve this answer












                                    It is sometimes useful to use -print explicitly when you are performing another action so the filename is displayed as that action is performed.



                                    find . -print -delete


                                    would be similar to



                                    rm -rfv *


                                    where -print corresponds to -v. If you don't include -print then the filenames aren't displayed.



                                    In order to make the rm command even more similar, by the way, issue this Bash command first



                                    shopt -s dotglob


                                    which will make the * match dot (hidden) files.







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Apr 22 '15 at 19:21









                                    Dennis Williamson

                                    5,32812232




                                    5,32812232






























                                        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.





                                        Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                        Please pay close attention to the following guidance:


                                        • 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%2f197824%2fwhat-is-the-difference-between-find-and-find-print%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

                                        Morgemoulin

                                        Scott Moir

                                        Souastre