What does the directory `//` in the shell command `rm -rf //` do, precisely?












-2















I accidentally ran this command while trying to remove an errant directory named \ from my project directory. Quite a mistake I know. It pretty quickly began hitting permissioned files at which point I realized my mistake so I ctrl-c'ed out of there. I have all my important projects backed up but the command killed my development environment. Opening vim anywhere is crashing and throwing a segfault like so:



Vim: Caught deadly signal SEGV

Error detected while processing function <SNR>130_PollServerReady[7]..<SNR>130_Pyeval:Vim: Finished.

line 4:
Exception MemoryError: MemoryError() in <module 'threading' from '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.pyc'> ignored
[1] 6921 segmentation fault vim ~/dotfiles/.vimrc


My primary question for myself and anyone who commits a similar gaff is:



What, precisely does the double backslash // point to? What would be deleted first? Is there a logical first place to begin replacing util, configs, $PATH stuff etc?



Hopefully, this is clear and specific enough for SO.










share|improve this question























  • This might be related to GNU rm. I'm not interested in testing this command, but perhaps (in GNU coreutils, which is not standard in Mac OS) rm -rf // may be equivalent to rm -rf --no-preserve-root /

    – Adam Katz
    Nov 20 '18 at 16:47













  • This doesn't look like a programming-related question, I think it belongs more on another network. Maybe serverfault.stackexchange ?

    – ChatterOne
    Nov 21 '18 at 8:41
















-2















I accidentally ran this command while trying to remove an errant directory named \ from my project directory. Quite a mistake I know. It pretty quickly began hitting permissioned files at which point I realized my mistake so I ctrl-c'ed out of there. I have all my important projects backed up but the command killed my development environment. Opening vim anywhere is crashing and throwing a segfault like so:



Vim: Caught deadly signal SEGV

Error detected while processing function <SNR>130_PollServerReady[7]..<SNR>130_Pyeval:Vim: Finished.

line 4:
Exception MemoryError: MemoryError() in <module 'threading' from '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.pyc'> ignored
[1] 6921 segmentation fault vim ~/dotfiles/.vimrc


My primary question for myself and anyone who commits a similar gaff is:



What, precisely does the double backslash // point to? What would be deleted first? Is there a logical first place to begin replacing util, configs, $PATH stuff etc?



Hopefully, this is clear and specific enough for SO.










share|improve this question























  • This might be related to GNU rm. I'm not interested in testing this command, but perhaps (in GNU coreutils, which is not standard in Mac OS) rm -rf // may be equivalent to rm -rf --no-preserve-root /

    – Adam Katz
    Nov 20 '18 at 16:47













  • This doesn't look like a programming-related question, I think it belongs more on another network. Maybe serverfault.stackexchange ?

    – ChatterOne
    Nov 21 '18 at 8:41














-2












-2








-2








I accidentally ran this command while trying to remove an errant directory named \ from my project directory. Quite a mistake I know. It pretty quickly began hitting permissioned files at which point I realized my mistake so I ctrl-c'ed out of there. I have all my important projects backed up but the command killed my development environment. Opening vim anywhere is crashing and throwing a segfault like so:



Vim: Caught deadly signal SEGV

Error detected while processing function <SNR>130_PollServerReady[7]..<SNR>130_Pyeval:Vim: Finished.

line 4:
Exception MemoryError: MemoryError() in <module 'threading' from '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.pyc'> ignored
[1] 6921 segmentation fault vim ~/dotfiles/.vimrc


My primary question for myself and anyone who commits a similar gaff is:



What, precisely does the double backslash // point to? What would be deleted first? Is there a logical first place to begin replacing util, configs, $PATH stuff etc?



Hopefully, this is clear and specific enough for SO.










share|improve this question














I accidentally ran this command while trying to remove an errant directory named \ from my project directory. Quite a mistake I know. It pretty quickly began hitting permissioned files at which point I realized my mistake so I ctrl-c'ed out of there. I have all my important projects backed up but the command killed my development environment. Opening vim anywhere is crashing and throwing a segfault like so:



Vim: Caught deadly signal SEGV

Error detected while processing function <SNR>130_PollServerReady[7]..<SNR>130_Pyeval:Vim: Finished.

line 4:
Exception MemoryError: MemoryError() in <module 'threading' from '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.pyc'> ignored
[1] 6921 segmentation fault vim ~/dotfiles/.vimrc


My primary question for myself and anyone who commits a similar gaff is:



What, precisely does the double backslash // point to? What would be deleted first? Is there a logical first place to begin replacing util, configs, $PATH stuff etc?



Hopefully, this is clear and specific enough for SO.







macos shell vim zsh rm






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 '18 at 16:09









Justus EapenJustus Eapen

691521




691521













  • This might be related to GNU rm. I'm not interested in testing this command, but perhaps (in GNU coreutils, which is not standard in Mac OS) rm -rf // may be equivalent to rm -rf --no-preserve-root /

    – Adam Katz
    Nov 20 '18 at 16:47













  • This doesn't look like a programming-related question, I think it belongs more on another network. Maybe serverfault.stackexchange ?

    – ChatterOne
    Nov 21 '18 at 8:41



















  • This might be related to GNU rm. I'm not interested in testing this command, but perhaps (in GNU coreutils, which is not standard in Mac OS) rm -rf // may be equivalent to rm -rf --no-preserve-root /

    – Adam Katz
    Nov 20 '18 at 16:47













  • This doesn't look like a programming-related question, I think it belongs more on another network. Maybe serverfault.stackexchange ?

    – ChatterOne
    Nov 21 '18 at 8:41

















This might be related to GNU rm. I'm not interested in testing this command, but perhaps (in GNU coreutils, which is not standard in Mac OS) rm -rf // may be equivalent to rm -rf --no-preserve-root /

– Adam Katz
Nov 20 '18 at 16:47







This might be related to GNU rm. I'm not interested in testing this command, but perhaps (in GNU coreutils, which is not standard in Mac OS) rm -rf // may be equivalent to rm -rf --no-preserve-root /

– Adam Katz
Nov 20 '18 at 16:47















This doesn't look like a programming-related question, I think it belongs more on another network. Maybe serverfault.stackexchange ?

– ChatterOne
Nov 21 '18 at 8:41





This doesn't look like a programming-related question, I think it belongs more on another network. Maybe serverfault.stackexchange ?

– ChatterOne
Nov 21 '18 at 8:41












2 Answers
2






active

oldest

votes


















2














cd // will take you to the root directory /.



rm performs a depth-first search, walking the results of the xfts_open call. find also traverses filesystems in this manner.



find / will list the files that exist. You can then use your knowledge of the expected structure to reverse the list that are missing.



Alternatively, you can use debugfs to help you get at the files.



This assumes that these commands will actually work. Realistically, your system is probably hosed. Deleting things in / will break your computer. Restoring from backup is probably the easiest way to return to a functional system. You can also try various utilities to recover recently erased files from your hard drive; if you plan on doing this, you should stop using your computer, as your hard drive currently treats many areas as free space (since you told it to) which recently held files in / and it could start writing to those areas.






share|improve this answer



















  • 1





    If it was run as an independent user, then it should have only deleted files which that user has access to, which may have included an install of vim. You could try reinstalling vim. If it was run as root then your system is definitely hosed. Backup what you can and reinstall.

    – Conner
    Nov 20 '18 at 18:31











  • @Conner, that's a good point, thanks

    – jeremysprofile
    Nov 21 '18 at 17:56



















0














In Linux, and I believe other *nix flavours, an extra slash in a path is simply ignored. Thus, a//b is the same as a/b and // is the same as /. I hope you didn't run this as a superuser...






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    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%2fstackoverflow.com%2fquestions%2f53397061%2fwhat-does-the-directory-in-the-shell-command-rm-rf-do-precisely%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









    2














    cd // will take you to the root directory /.



    rm performs a depth-first search, walking the results of the xfts_open call. find also traverses filesystems in this manner.



    find / will list the files that exist. You can then use your knowledge of the expected structure to reverse the list that are missing.



    Alternatively, you can use debugfs to help you get at the files.



    This assumes that these commands will actually work. Realistically, your system is probably hosed. Deleting things in / will break your computer. Restoring from backup is probably the easiest way to return to a functional system. You can also try various utilities to recover recently erased files from your hard drive; if you plan on doing this, you should stop using your computer, as your hard drive currently treats many areas as free space (since you told it to) which recently held files in / and it could start writing to those areas.






    share|improve this answer



















    • 1





      If it was run as an independent user, then it should have only deleted files which that user has access to, which may have included an install of vim. You could try reinstalling vim. If it was run as root then your system is definitely hosed. Backup what you can and reinstall.

      – Conner
      Nov 20 '18 at 18:31











    • @Conner, that's a good point, thanks

      – jeremysprofile
      Nov 21 '18 at 17:56
















    2














    cd // will take you to the root directory /.



    rm performs a depth-first search, walking the results of the xfts_open call. find also traverses filesystems in this manner.



    find / will list the files that exist. You can then use your knowledge of the expected structure to reverse the list that are missing.



    Alternatively, you can use debugfs to help you get at the files.



    This assumes that these commands will actually work. Realistically, your system is probably hosed. Deleting things in / will break your computer. Restoring from backup is probably the easiest way to return to a functional system. You can also try various utilities to recover recently erased files from your hard drive; if you plan on doing this, you should stop using your computer, as your hard drive currently treats many areas as free space (since you told it to) which recently held files in / and it could start writing to those areas.






    share|improve this answer



















    • 1





      If it was run as an independent user, then it should have only deleted files which that user has access to, which may have included an install of vim. You could try reinstalling vim. If it was run as root then your system is definitely hosed. Backup what you can and reinstall.

      – Conner
      Nov 20 '18 at 18:31











    • @Conner, that's a good point, thanks

      – jeremysprofile
      Nov 21 '18 at 17:56














    2












    2








    2







    cd // will take you to the root directory /.



    rm performs a depth-first search, walking the results of the xfts_open call. find also traverses filesystems in this manner.



    find / will list the files that exist. You can then use your knowledge of the expected structure to reverse the list that are missing.



    Alternatively, you can use debugfs to help you get at the files.



    This assumes that these commands will actually work. Realistically, your system is probably hosed. Deleting things in / will break your computer. Restoring from backup is probably the easiest way to return to a functional system. You can also try various utilities to recover recently erased files from your hard drive; if you plan on doing this, you should stop using your computer, as your hard drive currently treats many areas as free space (since you told it to) which recently held files in / and it could start writing to those areas.






    share|improve this answer













    cd // will take you to the root directory /.



    rm performs a depth-first search, walking the results of the xfts_open call. find also traverses filesystems in this manner.



    find / will list the files that exist. You can then use your knowledge of the expected structure to reverse the list that are missing.



    Alternatively, you can use debugfs to help you get at the files.



    This assumes that these commands will actually work. Realistically, your system is probably hosed. Deleting things in / will break your computer. Restoring from backup is probably the easiest way to return to a functional system. You can also try various utilities to recover recently erased files from your hard drive; if you plan on doing this, you should stop using your computer, as your hard drive currently treats many areas as free space (since you told it to) which recently held files in / and it could start writing to those areas.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 20 '18 at 16:53









    jeremysprofilejeremysprofile

    1,6721617




    1,6721617








    • 1





      If it was run as an independent user, then it should have only deleted files which that user has access to, which may have included an install of vim. You could try reinstalling vim. If it was run as root then your system is definitely hosed. Backup what you can and reinstall.

      – Conner
      Nov 20 '18 at 18:31











    • @Conner, that's a good point, thanks

      – jeremysprofile
      Nov 21 '18 at 17:56














    • 1





      If it was run as an independent user, then it should have only deleted files which that user has access to, which may have included an install of vim. You could try reinstalling vim. If it was run as root then your system is definitely hosed. Backup what you can and reinstall.

      – Conner
      Nov 20 '18 at 18:31











    • @Conner, that's a good point, thanks

      – jeremysprofile
      Nov 21 '18 at 17:56








    1




    1





    If it was run as an independent user, then it should have only deleted files which that user has access to, which may have included an install of vim. You could try reinstalling vim. If it was run as root then your system is definitely hosed. Backup what you can and reinstall.

    – Conner
    Nov 20 '18 at 18:31





    If it was run as an independent user, then it should have only deleted files which that user has access to, which may have included an install of vim. You could try reinstalling vim. If it was run as root then your system is definitely hosed. Backup what you can and reinstall.

    – Conner
    Nov 20 '18 at 18:31













    @Conner, that's a good point, thanks

    – jeremysprofile
    Nov 21 '18 at 17:56





    @Conner, that's a good point, thanks

    – jeremysprofile
    Nov 21 '18 at 17:56













    0














    In Linux, and I believe other *nix flavours, an extra slash in a path is simply ignored. Thus, a//b is the same as a/b and // is the same as /. I hope you didn't run this as a superuser...






    share|improve this answer




























      0














      In Linux, and I believe other *nix flavours, an extra slash in a path is simply ignored. Thus, a//b is the same as a/b and // is the same as /. I hope you didn't run this as a superuser...






      share|improve this answer


























        0












        0








        0







        In Linux, and I believe other *nix flavours, an extra slash in a path is simply ignored. Thus, a//b is the same as a/b and // is the same as /. I hope you didn't run this as a superuser...






        share|improve this answer













        In Linux, and I believe other *nix flavours, an extra slash in a path is simply ignored. Thus, a//b is the same as a/b and // is the same as /. I hope you didn't run this as a superuser...







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 21 '18 at 15:02









        joanisjoanis

        722314




        722314






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • 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%2fstackoverflow.com%2fquestions%2f53397061%2fwhat-does-the-directory-in-the-shell-command-rm-rf-do-precisely%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

            MongoDB - Not Authorized To Execute Command

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

            Npm cannot find a required file even through it is in the searched directory