I used the find command without specifying a directory












0















I used this command without specifying a directory:



sudo find -type d -exec chmod 755 {} 


What could have happened? I was in the /var/www/html folder. Did it change any permissions outside the /var/www/html directory?










share|improve this question



























    0















    I used this command without specifying a directory:



    sudo find -type d -exec chmod 755 {} 


    What could have happened? I was in the /var/www/html folder. Did it change any permissions outside the /var/www/html directory?










    share|improve this question

























      0












      0








      0








      I used this command without specifying a directory:



      sudo find -type d -exec chmod 755 {} 


      What could have happened? I was in the /var/www/html folder. Did it change any permissions outside the /var/www/html directory?










      share|improve this question














      I used this command without specifying a directory:



      sudo find -type d -exec chmod 755 {} 


      What could have happened? I was in the /var/www/html folder. Did it change any permissions outside the /var/www/html directory?







      command-line permissions find chmod






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 8 '18 at 6:55









      CayenneCayenne

      31




      31






















          2 Answers
          2






          active

          oldest

          votes


















          1














          You missed a ; or a {} + and can skip path (to run find starting in current dir)



          sudo find -type d -exec chmod 755 {} ;


          In this case your search start in current directory with subdirs. But You can set directory obviously.



          Current dir:



          sudo find . -type d -exec chmod 755 {} ;


          Absolute path:



          sudo find /var/www/html -type d -exec chmod 755 {} ;


          Explanation:



          sudo - run as superuser



          find -type d - search directories only (if you need files only use find -type f. If You isn't matter files or dirs, just remove -type d[f] from command).



          -exec chmod 755 {} ; - run command chmod 755 for each founded object in command which init -exec param (in this case find command).



          -exec chmod 755 {} + - run command chmod 755 for full array of founded results at once..






          share|improve this answer





















          • 2





            Your missing the point OP used a command and left out the directory part but like you observed OP also didn't add ; after `` so the command didn't run or did it? That is what OP is trying to find out if any damage was done!

            – George Udosen
            Dec 8 '18 at 7:35













          • @GeorgeUdosen yep, thanks! I started answering a more complex question in this context, but then noticed a typo and fix..

            – mature
            Dec 8 '18 at 7:39



















          2














          Ubuntu uses GNU find, which assumes current working directory if you don't specify one. Specifically, it assumes . and all items that are found by the command will have ./ prefix to their path when passed to -exec command. So it would only traverse /var/www/html; if your current working directory really was in /var/www/html nothing outside of that would be affected. Other implementations of find may require directory argument as BSD find for example.



          However, as mature's answer mentioned, your syntax is incomplete, hence that command wouldn't run. The at the end would tell the shell the command is incomplete and show PS2 prompt which is >






          share|improve this answer

























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            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: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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%2faskubuntu.com%2fquestions%2f1099338%2fi-used-the-find-command-without-specifying-a-directory%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            You missed a ; or a {} + and can skip path (to run find starting in current dir)



            sudo find -type d -exec chmod 755 {} ;


            In this case your search start in current directory with subdirs. But You can set directory obviously.



            Current dir:



            sudo find . -type d -exec chmod 755 {} ;


            Absolute path:



            sudo find /var/www/html -type d -exec chmod 755 {} ;


            Explanation:



            sudo - run as superuser



            find -type d - search directories only (if you need files only use find -type f. If You isn't matter files or dirs, just remove -type d[f] from command).



            -exec chmod 755 {} ; - run command chmod 755 for each founded object in command which init -exec param (in this case find command).



            -exec chmod 755 {} + - run command chmod 755 for full array of founded results at once..






            share|improve this answer





















            • 2





              Your missing the point OP used a command and left out the directory part but like you observed OP also didn't add ; after `` so the command didn't run or did it? That is what OP is trying to find out if any damage was done!

              – George Udosen
              Dec 8 '18 at 7:35













            • @GeorgeUdosen yep, thanks! I started answering a more complex question in this context, but then noticed a typo and fix..

              – mature
              Dec 8 '18 at 7:39
















            1














            You missed a ; or a {} + and can skip path (to run find starting in current dir)



            sudo find -type d -exec chmod 755 {} ;


            In this case your search start in current directory with subdirs. But You can set directory obviously.



            Current dir:



            sudo find . -type d -exec chmod 755 {} ;


            Absolute path:



            sudo find /var/www/html -type d -exec chmod 755 {} ;


            Explanation:



            sudo - run as superuser



            find -type d - search directories only (if you need files only use find -type f. If You isn't matter files or dirs, just remove -type d[f] from command).



            -exec chmod 755 {} ; - run command chmod 755 for each founded object in command which init -exec param (in this case find command).



            -exec chmod 755 {} + - run command chmod 755 for full array of founded results at once..






            share|improve this answer





















            • 2





              Your missing the point OP used a command and left out the directory part but like you observed OP also didn't add ; after `` so the command didn't run or did it? That is what OP is trying to find out if any damage was done!

              – George Udosen
              Dec 8 '18 at 7:35













            • @GeorgeUdosen yep, thanks! I started answering a more complex question in this context, but then noticed a typo and fix..

              – mature
              Dec 8 '18 at 7:39














            1












            1








            1







            You missed a ; or a {} + and can skip path (to run find starting in current dir)



            sudo find -type d -exec chmod 755 {} ;


            In this case your search start in current directory with subdirs. But You can set directory obviously.



            Current dir:



            sudo find . -type d -exec chmod 755 {} ;


            Absolute path:



            sudo find /var/www/html -type d -exec chmod 755 {} ;


            Explanation:



            sudo - run as superuser



            find -type d - search directories only (if you need files only use find -type f. If You isn't matter files or dirs, just remove -type d[f] from command).



            -exec chmod 755 {} ; - run command chmod 755 for each founded object in command which init -exec param (in this case find command).



            -exec chmod 755 {} + - run command chmod 755 for full array of founded results at once..






            share|improve this answer















            You missed a ; or a {} + and can skip path (to run find starting in current dir)



            sudo find -type d -exec chmod 755 {} ;


            In this case your search start in current directory with subdirs. But You can set directory obviously.



            Current dir:



            sudo find . -type d -exec chmod 755 {} ;


            Absolute path:



            sudo find /var/www/html -type d -exec chmod 755 {} ;


            Explanation:



            sudo - run as superuser



            find -type d - search directories only (if you need files only use find -type f. If You isn't matter files or dirs, just remove -type d[f] from command).



            -exec chmod 755 {} ; - run command chmod 755 for each founded object in command which init -exec param (in this case find command).



            -exec chmod 755 {} + - run command chmod 755 for full array of founded results at once..







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Dec 8 '18 at 7:50

























            answered Dec 8 '18 at 7:03









            maturemature

            1,696524




            1,696524








            • 2





              Your missing the point OP used a command and left out the directory part but like you observed OP also didn't add ; after `` so the command didn't run or did it? That is what OP is trying to find out if any damage was done!

              – George Udosen
              Dec 8 '18 at 7:35













            • @GeorgeUdosen yep, thanks! I started answering a more complex question in this context, but then noticed a typo and fix..

              – mature
              Dec 8 '18 at 7:39














            • 2





              Your missing the point OP used a command and left out the directory part but like you observed OP also didn't add ; after `` so the command didn't run or did it? That is what OP is trying to find out if any damage was done!

              – George Udosen
              Dec 8 '18 at 7:35













            • @GeorgeUdosen yep, thanks! I started answering a more complex question in this context, but then noticed a typo and fix..

              – mature
              Dec 8 '18 at 7:39








            2




            2





            Your missing the point OP used a command and left out the directory part but like you observed OP also didn't add ; after `` so the command didn't run or did it? That is what OP is trying to find out if any damage was done!

            – George Udosen
            Dec 8 '18 at 7:35







            Your missing the point OP used a command and left out the directory part but like you observed OP also didn't add ; after `` so the command didn't run or did it? That is what OP is trying to find out if any damage was done!

            – George Udosen
            Dec 8 '18 at 7:35















            @GeorgeUdosen yep, thanks! I started answering a more complex question in this context, but then noticed a typo and fix..

            – mature
            Dec 8 '18 at 7:39





            @GeorgeUdosen yep, thanks! I started answering a more complex question in this context, but then noticed a typo and fix..

            – mature
            Dec 8 '18 at 7:39













            2














            Ubuntu uses GNU find, which assumes current working directory if you don't specify one. Specifically, it assumes . and all items that are found by the command will have ./ prefix to their path when passed to -exec command. So it would only traverse /var/www/html; if your current working directory really was in /var/www/html nothing outside of that would be affected. Other implementations of find may require directory argument as BSD find for example.



            However, as mature's answer mentioned, your syntax is incomplete, hence that command wouldn't run. The at the end would tell the shell the command is incomplete and show PS2 prompt which is >






            share|improve this answer






























              2














              Ubuntu uses GNU find, which assumes current working directory if you don't specify one. Specifically, it assumes . and all items that are found by the command will have ./ prefix to their path when passed to -exec command. So it would only traverse /var/www/html; if your current working directory really was in /var/www/html nothing outside of that would be affected. Other implementations of find may require directory argument as BSD find for example.



              However, as mature's answer mentioned, your syntax is incomplete, hence that command wouldn't run. The at the end would tell the shell the command is incomplete and show PS2 prompt which is >






              share|improve this answer




























                2












                2








                2







                Ubuntu uses GNU find, which assumes current working directory if you don't specify one. Specifically, it assumes . and all items that are found by the command will have ./ prefix to their path when passed to -exec command. So it would only traverse /var/www/html; if your current working directory really was in /var/www/html nothing outside of that would be affected. Other implementations of find may require directory argument as BSD find for example.



                However, as mature's answer mentioned, your syntax is incomplete, hence that command wouldn't run. The at the end would tell the shell the command is incomplete and show PS2 prompt which is >






                share|improve this answer















                Ubuntu uses GNU find, which assumes current working directory if you don't specify one. Specifically, it assumes . and all items that are found by the command will have ./ prefix to their path when passed to -exec command. So it would only traverse /var/www/html; if your current working directory really was in /var/www/html nothing outside of that would be affected. Other implementations of find may require directory argument as BSD find for example.



                However, as mature's answer mentioned, your syntax is incomplete, hence that command wouldn't run. The at the end would tell the shell the command is incomplete and show PS2 prompt which is >







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Dec 8 '18 at 7:47

























                answered Dec 8 '18 at 7:39









                Sergiy KolodyazhnyySergiy Kolodyazhnyy

                70.5k9146309




                70.5k9146309






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • 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%2faskubuntu.com%2fquestions%2f1099338%2fi-used-the-find-command-without-specifying-a-directory%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 send String Array data to Server using php in android

                    Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                    Is anime1.com a legal site for watching anime?