645
Rule for Beginners (lemmy.world)
submitted 9 months ago* (last edited 9 months ago) by ThisIsAManWhoKnowsHowToGling@lemmy.dbzer0.com to c/196

cross-posted from: https://lemmy.dbzer0.com/post/14479799

Linux Best Practices

you are viewing a single comment's thread
view the rest of the comments
[-] TxzK@lemmy.zip 67 points 9 months ago

Every time this gets reposted, I like to reply with this:

:(){:|:&};:

Run it if you dare lol

[-] sag@lemm.ee 40 points 9 months ago

Why my cpu making so much noise?

[-] vynaaa@lemmy.world 37 points 9 months ago

It's a workout for your CPU. It will make it grow big and strong.

[-] rhebucks-zh@incremental.social 2 points 9 months ago

it's a regex loop

[-] Kusimulkku@lemm.ee 32 points 9 months ago

Extra room heater, how thoughtful of you

[-] Skyhighatrist@lemmy.ca 2 points 9 months ago* (last edited 9 months ago)

I don't know what that is, but it feels to me like it might be a fork bomb.

Edit: Yep, fork bomb.

[-] tb_@lemmy.world 3 points 9 months ago* (last edited 9 months ago)

Because I didn't know what a fork bomb was:

a fork bomb is a denial-of-service (DoS) attack wherein a process continually replicates itself to deplete available system resources, slowing down or crashing the system due to resource starvation.

[...]

A classic example of a fork bomb is one written in Unix shell :(){ :|:& };:, possibly dating back to 1999, which can be more easily understood as

fork() { fork | fork & } fork

> 
> In it, a function is defined (fork()) as calling itself (fork), then piping (|) its result into itself, all in a background job (&).
> 
> The code using a colon `:` as the function name is not valid in a shell as defined by POSIX, which only permits alphanumeric characters and underscores in function names. However, its usage is allowed in GNU Bash as an extension.

[Wikipedia](https://en.wikipedia.org/wiki/Fork_bomb)
[-] barsoap@lemm.ee 1 points 9 months ago* (last edited 9 months ago)

You're telling markdown to format the code in the language fork() { and then break the code block early by not having > in front of the next line. Here's a quoted code block formatted in sh:

fork() {
   fork | fork &
}
fork
[-] tb_@lemmy.world 1 points 9 months ago

It seems the app I use to browse doesn't play entirely nice with markdown. I updated my formatting a little, thanks for the notice.

[-] fallingcats@discuss.tchncs.de 1 points 9 months ago* (last edited 9 months ago)

Shouldn't this run into the ulimit and stop?

this post was submitted on 16 Feb 2024
645 points (100.0% liked)

196

16624 readers
2323 users here now

Be sure to follow the rule before you head out.

Rule: You must post before you leave.

^other^ ^rules^

founded 2 years ago
MODERATORS