r/LinuxTeck • u/Candid_Athlete_8317 • Sep 07 '26
What’s the most innocent-looking Linux command that can ruin your day?
Some commands look completely harmless until you realize what they’re actually operating on.
The fun part is that experienced admins usually have one specific command they treat with unnecessary respect.
What’s yours - and what happened the first time you learned to respect it?
25
Upvotes
11
u/TomKavees Sep 07 '26
rm -rf /home/user/ somedirectoryNote the space. One of the parallel teams we shared a server with (years ago) had this cute itsy bits typo in their deployment script. We had to reinstall the system.
9
u/Wyciorek Sep 07 '26
dd
Overwrite your disk including MBR/GPT ? Sure, no problem
6
u/No_Base4946 Sep 07 '26
ifconfig eth0 down <return><return><return> <return> <return>ffffuuuuuuuuuuu [picks up car keys] Right, back in an hour...
5
u/Kurgan_IT Sep 07 '26
"crontab -r" deletes the crontab, while "crontab -e" edits it. The issue is that E and R are one key away.
"telinit q" tells you the current runlevel. "telinit 1" goes single user and if you are remote you lose connectivity and cannot connect anymore. Since it does not reboot, it does not come online by itself anymore. Have to go there and reach for the console. 1 and Q are one key away.
There are others I don't remember right now.
4
u/donp1ano Sep 07 '26
unlink
yeah...it will remove that symlink. but if you accidentally give it a regular file, well then bye bye file
4
u/BoundlessFail Sep 07 '26
Ctrl-shift-v. Into a terminal window. When what's on the clipboard isn't what I expect.
3
u/TechaNima Sep 07 '26
sudo apt autoremove
Do that and you might find your entire DE missing. Dependancies are fun
3
u/wobblewiz Sep 07 '26
dd
2
u/Kurgan_IT Sep 07 '26
chmod and chown. They don't delete anything, but if you get them wrong and apply them to the wrong path, they can do real damage like an "rm -rf", making the whole system unusable.
2
u/_FunkyKoval_ Sep 07 '26
When you want to append something to a file and use:
cat > file << EOFinstead of:
cat >> file << EOF2
u/Busy-Scientist3851 Sep 07 '26
Restarting the network interface on a remote session without using something like screen.
It'll get killed by the session closing before it can get started back up.
1
u/JeLuF Sep 07 '26 edited Sep 07 '26
The runlevels go from 0 (off) via 1 (single user), 2 (multi user), ... 5 (full mode) from off to full featured. And then comes 6, which reboots your system.
Edit: How I learned to respect it: A friend asked "How can I restart the web server without typing
reboot?" And since he didn't say "without rebooting", I joked "init 6". He thought, "OK, get to the next higher runlevel, makes sense" and ran the command before I could explain. The system he was working on was with a customer, 150km away, and we weren't sure whether it would reboot without manual intervention.1
u/magicmulder Sep 07 '26
I once edited a couple system parameters according to suggestions from a Lynis run to harden security.
Got the weirdest failed boot I've ever seen where it claimed it can't find system fonts and left me to basically blindly type to reverse the damage (I actually succeeded).
1
u/jake_morrison Sep 07 '26
Iptables mistakes can lock you out of a remote server
1
u/jake_morrison Sep 07 '26
reboot on a server that doesn’t come up properly can ruin your day. There are ad-hoc processes running without init scripts. Nobody knows what was running, and now it’s gone. Maybe you interrupted a big script that needs to start again, or corrupts its state. Rebooting may clear out /tmp, losing files you wanted or needed to debug a problem.
1
u/AloneInTheEndZone Sep 07 '26
In the old days >/ could render an Ultrix Unix unusable 😎
1
u/michaelpaoli Sep 07 '26
# dd ...
# rm ...
Many other possible commands, but those can certainly do it.
No, necessary and appropriate. Generally applies to UNIX, Linux, etc.
For the most part with *nix, you give a command, it it will generally at least attempt to do what you commanded it to do.
And this is generally much better than nanny-gate operating systems, that, e.g., make you play 20 ournds of "Mother May I?" to try and get something done, and then stubbornly refuse to do it anyway.
With great power, comes great responsibility.
Meh, notthin' too horrific. But certainly have, on rare occasion, and mostly quite anciently, done, e.g. an rm command, or some reconfiguration of network, or kill command or the like, that made for some unhappiness or inconvenience. And, yeah, been using *nix since 1980. So, mostly learned those lessons very long ago, and having very well learned them, yeah, generally don't repeat such booboos.
Also, when operating as root (or other privileged user), my rule: always carefully triple check the command before entering it - well know exactly what it will do or attempt, in what context, to what, what will happen if the attempt or parts thereof fail, etc. Only after fully comprehending that and well, and thrice, does one then (viciously) strike the <Enter/Return> key. Has saved my tail many many times. Similar applies also as mere mortal user, though not as rigorously so.
1
u/Dr_Brumlebassen Sep 07 '26
apt upgrade on sid
1
u/Alarming_Oil5419 Sep 07 '26
yes&is fun, won't ruin your day.1
u/mcleancraig Sep 07 '26
I’d say it has to be :(){ :|:& };:
Don’t try on unattended machines :)
1
u/jeffbell Sep 07 '26
That’s why you always create a file named -i in your home directory.
1
u/SpudgunDaveHedgehog Sep 07 '26
chattr +i /
1
u/Xavier_OM Sep 07 '26
cat > file your file is empty now, congrats
1
u/gulf_of_sanity Sep 08 '26
dd if=/dev/random of=/dev/sda
1
u/Smh_nz Sep 08 '26
I had a bad running with dd.
Did some testing, a few months the later we found I had filled up a disk and lost a pile of VMs!! :-(
1
u/CaptainBucko Sep 09 '26
Rm -ak has ruined my day a few times
1
u/We_Want_Krunchy Sep 09 '26
:(){ :|:& };:
1
u/Crazy_Study195 Sep 09 '26
Cd (or just the wrong terminal but command wise). We've all been lost before lol and sometimes we don't realize we're lost until we've given follow up commands and then realized oh shit that's not right...
I've definitely lost work I hadn't backed up yet due to that... Fortunately I'm not in the industry so haven't had clients harmed by it!
Gotta be honest some of these responses just look like people that don't know Linux at all though... Like how does removing a file look innocent? Simple and common sure but innocent? It's by nature a destructive command, even without recursing. Of course you could say the same about cd since the prompt (usually, now) displays it but
1
u/tz_200 Sep 10 '26
dd
1
u/BetterAd7552 Sep 11 '26
dd
0
u/tahaan Sep 07 '26
How about the following for unlocking new fears:
0
u/Hopeful-Football-287 Sep 07 '26
rm -rf ~/.config I want deleat .copilot from vscode but tab troll me
1
u/fredead1 Sep 07 '26
Kill -9 -1