The 5 New Linux-Destroying Spells

table of contents
This is Saito from the infrastructure team
This time, I'd like to change things up and introduce some of the most dangerous Linux commands in a ranking format. The title is:"The New Top 5Destructive Spells."
We also have some items that aren't in the rankings.
Let's get started!
5th place: iptables
sudo iptables -I INPUT -j DROP
● Evaluation point: It stops working in an instant
iptables is troublesome to use normally, but this command stops working the moment you type it
Therefore, it would be very troublesome if you try this on a server that cannot be restarted. On the other hand, if you can just restart it, it will still be possible to fix the problem
4th place: git
git reset --hard HEAD~3 && git push -u --force origin master
● Evaluation point: It will cause trouble for your colleagues
Forces an overwrite of the remote repository
Doing this will delete all of your coworkers' pushes, which is even worse since you're resetting them. This is something you should never do if you're working with a group of remote repositories
3rd place: chmod
sudo chmod -R 000 /
● Evaluation points: All become zero
It's a pretty dangerous command, but it goes through quite easily
After the command passes without any issues, you lose all access to the server, but the pwd command still returns the correct result
2nd place: rsync
mkdir hoge;sudo rsync -av --delete-excluded /hoge/ /
● Evaluation point: No longer synchronized
rsync is a command for synchronizing files, and it has many options. Of the many options, many of the necessary ones are grouped together under -a
Therefore,avoid using options with "delete" in their name.
Using the command above will erase everything, including the empty file and the OS.
1st place:rm
sudo rm -rf / --no-preserve-root
● Evaluation point: It can be erased after all
On recent OSes, if you type the command rm -rf /, which deletes everything under /, the OS will pause and the command will not run
However, there's an option that completely negates such kindness: --no-preserve-root . This will erase everything.
Not ranked
rm -rf <folder>
● Evaluation point: Easy to use
Using sudo makes this a very dangerous command, because it makes it very easy to delete folders and files. (Actually, there is a way to restore them, but we'll talk about that another time.)
This is a command that amateurs cannot type casually. I think some people may use it depending on the situation, so I have not ranked it. Please leave this type of work to server engineers as much as possible
summary
What did you think?
If you're in the same industry, your heart rate may have increased. Have a cup of tea and relax
There are also several other dangerous commands, such as the fork bomb :(){ :|:& };:, so please do not try fork bombs on Docker. There are precedents where they have caused fatal damage to the host OS
All the commands introduced here were performed on VirtualBox + Vagrant, but the entire box may disappear, or the Vagrantfile permissions or file itself may be lost. Please do not use this on a business computer
That's all
19
