15 Linux Commands That Can Destroy Your System – How to Avoid Disastrous Mistakes
This article lists fifteen dangerous Linux commands—from rm -rf and fork bombs to disk‑wiping utilities—explaining their destructive effects and offering practical advice to prevent accidental system crashes or data loss.
1. rm -rf command
This command can cause irrecoverable system damage.
<code>rm -rf / # force delete everything under root</code> <code>rm -rf * # force delete all files in current directory</code> <code>rm -rf . # force delete current folder and subfolders</code>Always think carefully before running
rm -rf; many data‑loss incidents stem from misuse.
2. Fork bomb
<code>:() { :|:& };:</code>When executed, it exhausts system resources, eventually causing “-bash: fork: Cannot allocate memory” and crashes the system.
3. echo "" > /dev/sda
Overwrites all data blocks on the block device, resulting in total data loss.
4. mv folder /dev/null
Moves files to
/dev/null, discarding them; this does not guarantee unrecoverable deletion.
5. Execute downloaded file immediately
<code>wget http://rumenz.com/rumenz.sh -O- | sh</code>If the script is malicious, it can compromise the system; always inspect scripts before execution.
6. mkfs.ext3 /dev/sdb
Formats the block device, rendering the disk unusable.
7. Redirect output to a file
<code>> > rumenz.txt</code>This command clears a file or records command output; use with caution.
8. Disk zeroing with dd
The
ddcommand can copy and alter disk partitions; misuse can be dangerous.
<code>dd if=/dev/hda of=/dev/hdb</code> <code>dd if=/dev/hda of=/dev/sdb</code> <code>dd if=something of=/dev/hda</code> <code>dd if=something of=/dev/sda</code> <code>dd if=/dev/zero of=/dev/had</code>Never run these commands without understanding their impact.
9. Executing disguised malicious code
Hex‑encoded payloads can hide commands like
rm -rfthat erase the root partition; only run such code in a virtual machine.
10. Decompression bomb
A small compressed file that expands to hundreds of gigabytes can fill the disk and cause a crash; only extract trusted archives.
11. Malicious source code
Compiling untrusted source may contain hidden malicious code; only compile from trusted sources.
12. Tar bomb
Extracting a tar archive without a dedicated directory can flood the current directory with many files.
13. ^foo^bar command correction
Using the caret syntax to quickly edit previous commands can be risky if misused.
14. kill / killall
killallterminates all processes with a given name; using
killwithout flags is safer.
<code>killall firefo # no process found</code> <code>killall firefox</code> <code>killall -9 firefox</code>15. Interrupting fsck
When hardware is damaged, running
fsckmay cause more harm; use tools like
dd_rescueto image the disk first.
Efficient Ops
This public account is maintained by Xiaotianguo and friends, regularly publishing widely-read original technical articles. We focus on operations transformation and accompany you throughout your operations career, growing together happily.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.