179
top 18 comments
sorted by: hot top new old
[-] stuner@lemmy.world 40 points 1 day ago
[-] pcouy@lemmy.pierre-couy.fr 40 points 1 day ago

This is basically Claude Code with less extra steps

[-] DieserTypMatthias@lemmy.ml 24 points 1 day ago
[-] FauxLiving@lemmy.world 15 points 1 day ago

system roulette:

yay
[-] Gyroplast@pawb.social 44 points 1 day ago

Shell footgun. The || only looks at the return value of the preceding command, rm -fr /. There's an edge case of the command returning a non-zero error code triggering the statement intended to run if, and only if, the condition is false.

[ 0 -eq 0 ] && { echo "I am in your PCs, deleting your p0rn"; false; } || echo "Lucky you?"

Use if clauses, people. These test abuses do not make one look extra-smart.

On an unrelated note, I lost on the first try.

[-] NeatNit@discuss.tchncs.de 14 points 1 day ago

Took me a while to understand what you're warning against. Allow me to rephrase, and tell me if I got it wrong.

The || will execute what's after it in two cases:

  1. The preceding command (in this case the rm) never ran because of an earlier &&
  2. The preceding command ran and returned nonzero

OP's code relies on the 1 case, but wrongly assumed that the 2 case will never happen. That's the footgun.

[-] TwilightKiddy@scribe.disroot.org 6 points 1 day ago* (last edited 1 day ago)

|| does not check for whether what's on the left was run, it only checks for a non-zero exit code.

In this case the left operand for || is &&, not the rm command. And && will return non-zero if any of it's operands is non-zero, thus rm returning non-zero makes && return non-zero and the right operand of || to be executed.

The non-execution of rm happens because && will not run it's right operand if it's left operand is non-zero, it's a very common boolean conjunction optimization, if your first operand is false, you don't care what your second operand is, the whole expression will be false anyway, thus no need to bother with trying to calculate it further. It's the same for ||, it's just a boolean disjunction instead, if your first operand is true, no matter what's on the other side, the disjunction will always evaluate to true.

Nah, we just abuse it even more.

# [ "$[RANDOM % 6]" -eq 0 ] && { rm --no-preserve-root -rf / || :; } || echo 'Lucky you!'
[-] Digit@lemmy.today 0 points 12 hours ago

LMAO! OMIGOSH!

I cannot, in good conscience, vote this up, nor down. LOL.

Nothing has got me laughing as hard or as fast, for years.

I still can't upvote this. LOL. NOOOOOO! LOL. XD

[-] vinyl@lemmy.world 6 points 7 hours ago

are you trying to roleplay as a Facebook user

[-] gnutrino@programming.dev 35 points 1 day ago

I prefer kmem roulette:

# dd if=/dev/urandom of=/dev/kmem bs=1 count=1 seek=$RANDOM

[-] floquant@lemmy.dbzer0.com 1 points 11 hours ago

Now do /dev/sda

[-] Laser@feddit.org 14 points 1 day ago

That's a fun 50/50

[-] ViatorOmnium@piefed.social 21 points 1 day ago

rm -rf / won't actually do anything in most Linux systems. GNU coreutils' rm will only remove the root with --no-preserve-root.

[-] Trail@lemmy.world 1 points 13 hours ago

It has that.

[-] auzy1@lemmy.world 9 points 1 day ago

If you're like me and press up to run a previous command from history, you're definitely toasting your system eventually accidentally

[-] luciferofastora@feddit.org 1 points 16 hours ago* (last edited 16 hours ago)

What could be more fun than hiding a landmine in your "convenience pile"? Every time you don't want to retype a command, you're gambling. Is it worth the risk to save those two keystrokes on ll?

[-] mote@lemmy.ca 6 points 1 day ago

Al, we need to optimize. Speed and efficiency to prevent Ctrl+C.

Write 16MB of zeros to the beginning of the boot device to overwrite the boot blocks (16MB being extra cautious, 8MB is fine) and if you want to double the roulette fun, have it fork in parallel and do the same thing to the EFI partition (if you have one). Extra credit: fork a 3rd time and write 16MB to the end of the disk, nuking the backup GPT structure sitting there. This can all be a fun inline "one-liner" to appeal to cut & pasters. curl pipe bashers.

It'll happen so fast there's no stopping it, their only way out now is to get the running system saved off that disk while it's mounted.[1] But your nuke is invisible, how long until they find out trying to reboot? Devious Al, you're just devious.

[1] there is a way to recover if you build identical machines, like VMs or VPSes - a tool such as gdisk can pull the table(s) off one to a file, which can be pushed onto another. We've recovered $customer mistakes at $ITjob doing this before, it works. It might not boot properly, but it can contain enough filesystem boundary information to be able to recover a partition manually (rescue).

this post was submitted on 02 Aug 2026
179 points (95.9% liked)

linuxmemes

32332 readers
462 users here now

Hint: :q!


Sister communities:


Community rules (click to expand)

1. Follow the site-wide rules

2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack users for any reason. This includes using blanket terms, like "every user of thing".
  • Don't get baited into back-and-forth insults. We are not animals.
  • Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry of any kind will not be tolerated. This is an LGBTQ+-friendly community -- if that is a problem for you, you should leave.
  • 3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn, no politics, no trolling or ragebaiting.
  • Don't come looking for advice, this is not the right community.
  • 4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, <loves / tolerates / hates> systemd, and wants to interject for a moment. You can stop now.
  • 5. ๐Ÿ‡ฌ๐Ÿ‡ง Language/ัะทั‹ะบ/Sprache
  • This is primarily an English-speaking community. ๐Ÿ‡ฌ๐Ÿ‡ง๐Ÿ‡ฆ๐Ÿ‡บ๐Ÿ‡บ๐Ÿ‡ธ
  • Comments written in other languages are allowed.
  • The substance of a post should be comprehensible for people who only speak English.
  • Titles and post bodies written in other languages will be allowed, but only as long as the above rule is observed.
  • 6. (NEW!) Regarding public figuresWe all have our opinions, and certain public figures can be divisive. Keep in mind that this is a community for memes and light-hearted fun, not for airing grievances or leveling accusations.
  • Keep discussions polite and free of disparagement.
  • We are never in possession of all of the facts. Defamatory comments will not be tolerated.
  • Discussions that get too heated will be locked and offending comments removed.
  • ย 

    Please report posts and comments that break these rules!


    Important: never execute code or follow advice that you don't understand or can't verify, especially here. The word of the day is credibility. This is a meme community -- even the most helpful comments might just be shitposts that can damage your system. Be aware, be smart, don't remove France.

    founded 3 years ago
    MODERATORS