11 Evil Bash Linux commands Explained
If you want to be ba evil with this, you have it easy

With this post, I want to share some “useful” but dangerous commands that you should use carefully. My goal is to end for the moment the series of posts I have written focused on Linux bash.
You will find the links to the rest of the post at the end.
Without wanting to keep you any longer, let’s get started.
1. Delete a disk partition
A faster way than using the typical: “urandom” to fill the hard disk with random data and leave it unusable is to run OpenSSL AES in parallel mode.
$ sudo openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt </dev/zero > /dev/sda12. Disable Root Command Rights
Suppose you want to make the administration of your Linux system practically impossible and piss off more than one person. In that case, you can delete the “sudo” and “su” commands, and no one will be able to run anything in administrator mode anymore.
$ sudo rm -f /usr/bin/sudo
$ rm -f /bin/su3. Downloads and Runs a Script
A “sh script” can have good or destructive code; this is subjective. With “wget,” you can download the script, and with the “sh” command, you can execute it. You can always program it in the cron so that a script is downloaded from a URL at a specific time for running it.
$ sudo wget URL/script.sh -O- | sh - “|” Pipe (send) the output of the “wget” command directly to another command, in this case, “sh.”
- “sh”: executes the bash script.
4. Format the block ‘sda1’
The above command will create a new ext4 file system on the device. sda1 specifies a partition on the hard drive. Then, it simply formats the block ‘sda1’ and resets the hard drive.
$ sudo Mkfs.ext4 /dev/sda1- mkfs.ext4: Creates a new ext4 file system on the following device.
- /dev/sda1: Specifies the first partition on the first hard drive, which is probably in use.
5. > File
This command is often used to clear the contents of a file. But be careful, the original file cannot be restored, and the data recovery software may not be able to help you.
$ > File6. shred /dev/sda
With no possible solution, this much less known command can delete all files from a hard drive.
“Shred” is a tool that does not erase: it destroys. That is, it is not limited to removing a file from the file table but overwrites physical space dozens of times that it occupies, making it impossible to recover.
$ shred /dev/sda7. Kernel Panic
Although hardware problems usually cause these crashes, there are ways to simulate them. Running any of those commands will result in a kernel panic, forcing you to reboot your system.
When you encounter a kernel panic, you have no choice but to reboot the system to get back to work. Depending on where you run it, this can be just a nuisance or a big problem.
$ echo 1 > /proc/sys/kernel/panic$ cat /dev/port$ cat /dev/zero > /dev/mem8. Be bad
If an evil person adds this alias and then you use “cat” command to show a file, you will quickly notice strange behavior.
$ nano ~/.bashrc #Add the following content to the file:
alias cat = 'rm -rf'Add the command to “~/.bashrc” and reload with “source ~/.bashrc”
- “alias” declares shortcuts for bash commands.
- “cat” is the alias name and the same as the cat command.
- The original “cat” command shows the content of a file.
Now, when the innocent user runs “cat” it will run instead of cat “rm -rf” which will force the deletion of files without asking for confirmation.
$ cat file.txt9. Delete the boot directory
Deleting this directory will disable any system startup and thereby crash Linux. Very simple and effective
$ sudo rm -rf /boot10. Destroy an encrypted disk
The “fsck” command is used to detect and fix file system problems and does not usually have any adverse consequences except if your system is encrypted. In this case, “fsck” will attempt to correct it, wrecking it. Remember only to check your file system after it has been unlocked.
$ sudo fsck -y /dev/sda- The “-y” flag will attempt to fix any detected filesystem corruption automatically.
11. crontab -r
This command is used to automate tasks keeping all cron jobs in a single crontab file, which can be removed by specifying the “-r flag.” Unfortunately, you can do this by mistake when you want to set the -e flag and accidentally enter -r. Beware because there is no confirmation prompt before removing the file.
$ crontab -r - On Ubuntu/Debian, if your task has run before, try to grep CRON /var/log/syslog to recover it.
Final thoughts
I hope you have found this series of posts about the Linux shell helpful. But, of course, the your use of what is shown here is your responsibility.
Other super useful Linux commands:
- 18 Selected Super-Useful Linux One-Liners (And more Dangerous Linux Terminal Commands)
- 12 Awesome Linux Commands && Utilities
- The Linux Swiss army knife
- 25 Awesome Linux Command One-Liners




