In this article we are going to cover three commands you should know, but you should never use. Yes Linux is a great tool and gives you great power, but with that great power comes great responsibility. So without further ado lets start.
01 – The Fork Bomb :(){ :|:& };:
A fork bomb (also called rabbit virus or wabbit) is a denial-of-service attack wherein a process continually replicates itself to deplete available system resources. This is a simple bash function which once executed creates copies of itself which in turn creates another set of copies of itself.
Linux process limits can be configured via /etc/security/limits.conf and PAM to avoid bash fork() bomb.
# Understanding :(){ :|:& };: fork() bomb code
foo(){
arg1=$1
arg2=$2
echo 'Bar..'
#do_something on $arg argument
}
Code language: PHP (php)
02 – The Dev Null Command
In Linux there is a place like no place at all 🙂 It’s called /dev/null and everything you place there goes to a black hole. So in this example we are going to move our home directory in dev/null and that means that we are going to lose all the information we had.
# Destroy all information in root folder
mv /home/root/* dev/null
Code language: PHP (php)
03 – The Give Me Power Chmod -R 777/ Command
This is a common error command that does not affect the system in general but creates a security breach in the operating system. In this case we give read and write permissions to everyone dus making the system like a yard without a fence.
# Give Me All the POWER
chmod -r 777/
Code language: PHP (php)
Conclusion
There many more such examples, here we have learned about the most important thing -> we have to be careful while executing commands in Linux and we have to understand them!