4 ms·
echo {a..z} | tr ' ' '\n' | sort -R | head -1 > /proc/sysrq-trigger this is my favourite linux russian roulette
by tryauuum 4y ago
echo {a..z} | tr ' ' '\n' | sort -R | head -1 > /proc/sysrq-trigger
this is my favourite linux russian roulette
- LinuxBender 4y agoHere's a variant that works in #!/bin/ash base64 /dev/urandom | tr -d '/+'| sed s/[^[:alpha:]]//g |tr 'A-Z' 'a-z' | dd bs=1 count=1 2>/dev/null
- mhio 4y agoI hate to be a golfer... buuuut this should still be pretty generic shell LC_ALL=C tr -dc 'a-z' </dev/urandom | head -c 1
- tryauuum 4y agoI think you don't even need head -c 1 because sysrq-trigger will read only one character anyway
- mhio 4y agoNice one! I wasn't taking testing that far =) edit - Actually I don't think it closes the input, so for an initial char that doesn't cause something fatal it looks to continue writing.
- tryauuum 4y agojust tested -- only reads first char, at least with echo (also any character which is not used is used as "h") echo apm > /proc/sysrq-trigger I'm too scared to test with your urandom stuff...
- mhio 4y agoI saw that too, but in this case `echo` exits. My note was just regarding the pipeline will continue to write forever if the first character was any of the non destructive commands. Without trashing vms... ( while true; do printf 'a'; done ) > /proc/sysrq-trigger With the `head`, the output is closed.
- sillysaurusx 4y agoFor a moment I was excited to learn about a new shell named ash.
- captainkrtek 4y agohttps://en.wikipedia.org/wiki/Almquist_shell https://en.wikipedia.org/wiki/Almquist_shell
- joshenders 4y agoGot your wish
- stavros 4y agoThis echoes a letter to /proc/sysrq-trigger, with Deck of Many Fates results: https://www.kernel.org/doc/html/v4.15/admin-guide/sysrq.html#what-are-the-command-keys https://www.kernel.org/doc/html/v4.15/admin-guide/sysrq.html... EDIT: Yeah, uh, it works.