52

Lesson learnt :
Never ever do "rm -rf <pattern>" without doing "ls <pattern>" first.
I had to delete all the contents of my current directory.
I did "rm -rf /*" instead of "rm -rf ./*".

Comments
  • 1
    Ai, thats bad. Was it an important system?
  • 3
    I thought that some systems (Ubuntu) block this...
  • 9
    You see... shorter and safer would be to omit that ./ ;)
  • 6
    @snaz not in Arch Linux.
  • 3
    Testdisk and Photorec are your friends
  • 3
    This is what bash functions are for.

    Replace rm with a function that lists the pattern and prompts. Never delete something incorrect again.
  • 2
    I'm in one of then tags and nobody mentioned me yet?!
  • 4
    Why not just do

    $ rm -rf *

    instead of

    $ rm -rf ./*

    ?
  • 3
    Happens to everyone. I did something like that to the etc/ folder during server migration once...
    In my bashrc I've setup rm -rf to do an ls first and wait until I press enter to confirm it.
  • 2
  • 1
    One of the simplest solutions is to "cd .." and then "rm -rf" the specific folder.
    The other one is to use full paths and not relative ones.
    And, also to ls first and then remove with the same argument.
  • 0
    Exactly the same mistake happend to me..
  • 0
    @linuxxx don't you have that search pattern/tag listing favorited yet by now?
  • 0
    @xewl What? 😅
  • 0
  • 1
    @crawl I mean more like I can't favourite a tag so I don't understand 😅
  • 0
    @GeaRSiX kinda late to the party but can you hint me where i can get that (alias?) Thing?
  • 0
    Doing ./* is so unecessary when you can just do *
  • 0
    @ThatPerlDeb Do some research into the bashrc file. You can do loads of cool stuff with it :)
Add Comment