The Unix/Linux dd command is also known as “disk destroyer” if you swap if and of args even once 😭
Replying to @nixCraft@mastodon.social
Think twice before you hit that enter key and keep verified backups
Replying to @nixCraft@mastodon.social
Why don't Unix or Linux developers add safety nets, such as confirmation prompt to the dd command by default? That would save lots of headaches 😅
Replying to @nixCraft@mastodon.social
@nixCraft Putting a trigger lock on my foot-gun is disrespectful to my freedom.
Replying to @nixCraft@mastodon.social
@nixCraft
you're tired and type
rm -rf /temp
but accidentality hit Enter after /
They changed rm
The --preserve-root flag is a safeguard built into modern versions of the rm command to prevent the deletion of the root directory (/). By default, this option is enabled.
Double-check and explicitly set it for added safety.
When --preserve-root is enabled, rm -rf / is blocked
rm: it is dangerous to operate recursively on ‘/’
rm: use — no-preserve-root to override this failsafe
Replying to @raymaccarthy@mastodon.ie
@raymaccarthy @nixCraft I remember when someone had used: rm -f -r ..
Replying to @nixCraft@mastodon.social
@nixCraft They do! If they need guardrails then a wrapper script is used.
Replying to @nixCraft@mastodon.social
@nixCraft Linux commands are designed to be simple and do one thing only in the simplest possible way. Adding safety nets would just make things horrible to script. Always check man dd, before running sudo dd.
Replying to @nixCraft@mastodon.social
@nixCraft Unix is built on the "you asked for it - you got it" principle. It's not Windows.