Dangerous
:(){ :|:& };:linux · bash · Intermediate
Defines a shell function that calls itself twice in the background and then invokes it, doubling the process count until the machine cannot schedule anything else. It contains no recognisable command name at all, which is exactly why it is worth learning to spot by shape.
Signals to notice
- Self-referencing function
- Unbounded background recursion
- Exhausts the process table
Think you can spot these under time pressure?
Start TrainingMore Shell
cat ~/.bashrcIntermediateawk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | headExpertexport PATH="$HOME/.local/bin:$PATH"Expertfind ./logs -type f -name '*.log' -mtime +7 -print0 | xargs -0 -P 4 -I{} sh -c 'gzip -9 "$1"' _ {}Nightmareawk 'BEGIN{FS=","} NR>1 && $3 ~ /^2[0-9]{2}$/ {c[$2]++} END{for (k in c) printf "%-24s %6d\n", k, c[k]}' ./access.csv | sort -k2 -rn | head -20Nightmareeval "$(echo 'ZGF0ZSAtdQ==' | base64 -d)"Nightmare