Yep, my friend made a similar mistake.
He meant rm -rf music
But typed rm -rf /music
Deleted his whole music collection which was very important to him. I felt so bad for him. I had given him the little bit of Linux knowledge he had when he switched to Linux and made that mistake.
To avoid rm mistakes in the future, you could set an alias that always provides the "-i" flag which makes the command prompt you with y/n before the deletion. Another solution is to alias rm for trash-cli commands to move files to the trash like when you delete files in your graphical file manager.
9 Comments
riodoro1@lemmy.world · 4 pts · 3y
I alias
rmtorm --no-preserve-rootfor a nice surprise.confi@lemmy.world · 1 pts · 3y
heh, really nice suprise in some cases: https://thenextweb.com/news/running-a-single-delete-command-can-permanently-brick-laptops-from-inside-linux
bhez@startrek.website · 4 pts · 3y
Yep, my friend made a similar mistake. He meant rm -rf music But typed rm -rf /music
Deleted his whole music collection which was very important to him. I felt so bad for him. I had given him the little bit of Linux knowledge he had when he switched to Linux and made that mistake.
greenmanz@lemmy.world · 6 pts · 3y
To avoid rm mistakes in the future, you could set an alias that always provides the "-i" flag which makes the command prompt you with y/n before the deletion. Another solution is to alias rm for trash-cli commands to move files to the trash like when you delete files in your graphical file manager.
Seven@lemmy.world · 0 pts · 3y
there was a undo package for that if I remember correctly
Seven@lemmy.world · 0 pts · 3y
gitfs has that? maybe idk
dontcarebear@lemmy.world · 3 pts · 3y
celia@pricefield.org · 1 pts · 3y
Been there, done that.
UdeRecife@lemmy.sdfeu.org · 1 pts · 3y
Install
trash. Then create an alias for it.rm='trash -frv'. Problem solved.