[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


I shit you not, I have just accidentally rm -rf /* nuke my laptop while trying to remove all files from a directory. I realized I didn't input the dot when my vscode theme disappeared. I turned off my laptop and it won't boot.
I thought nowadays it asks you if you really wanna do this? I didn't lose anything important but FUCK
>>
>>107023604
only gay shit like ubuntu and probably catchyos warn you
>>
>>107023604
You can make fun of me for using a graphical file manager when I need to delete something as root, but I've never had this issue. Works on my machines.
>>
>>107023604
Worst case there is photorec that one could run on some recovery iso, thought you'd need some external storage to recover the files into. There are probably some other methods one could use
>>
>he doesn't have automatic btrfs snapshots
>>
>>107023604
This happened to me because I didn't know you had to put -delete at the END of find.

>find -type f -delete -name shit.txt

Nuked my whole home directory
>>
>>107023604
I did it on my phone twice. Termux.
>>
>>107023604
if you are not shitting yourself over messing up as soon as you have added the -rf flags your -rf license should be revoked
>>
>>107023604
haha OP I love froggo XD
>>
>>107025533
did the bot break
>>
File: 1736121660030428.png (593 KB, 850x567)
593 KB
593 KB PNG
>>107023604
>>
>>107023604
>vscode
linuk smelled the microsoft shit you're using, serves you right if you use vscode
>>
you at least attached the right picture OP. admitting you fucked up is step 1 towards recovering from this
>>
>>107025502
>path must precede expression
>>
>>107024649
Never had this issue either, and I almost exclusively use terminal for shit like that. Basically never use the -f (--force) flag for rm, tho.
>>
>>107023604
i think everyone has done this.
put this in your .bashrc
alias rm='__safe_rm'
__safe_rm() {
local current_dir
current_dir="$(pwd)"

# Change this path to your actual username if needed
if [[ "$current_dir" == "/home/user" || "$current_dir" == /home/user/* ]]; then
echo " rm is disabled in $current_dir"
return 1
fi

command rm "$@"
}



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.