The Bash command :(){ :|:& };: will spawn processes to kernel death. Can you explain the syntax?
That defines a function called :
which calls itself twice (Code: : | :
). It does that in the background (&
). After the ;
the function definition is done and the function :
gets started.
So every instance of : starts two new : and so on... Like a binary tree of processes...
Written in plain C that is:
fork();
fork();
BASH - What does _(){ _|_&}; _ do?
It's the classic fork bomb: it defines a function named _
that calls itself twice (once in the foreground and once in the background) and calls it:
bomb(){ bomb | bomb &}; bomb
bomb() {
bomb | bomb&
};
bomb
http://en.wikipedia.org/wiki/Fork_bomb
:(){ :|:& };: Forkbomb?
You define a function called :
. Inside this function you call this function twice (:|:
) and then you send that process to the background (&
). Then you finally call it at the end.
Because of the recursive nature, you'll keep forking. Since there is no base case, the recursion will never end.
How does this bash fork bomb work?
Breaking it down, there are three big pieces:
:() # Defines a function, ":". It takes no arguments.
{ ... }; # The body of the function.
: # Invoke the function ":" that was just defined.
Inside the body, the function is invoked twice and the pipeline is backgrounded; each successive invocation on the processes spawns even more calls to ":". This leads rapidly to an explosive consumption in system resources, grinding things to a halt.
Note that invoking it once, infinitely recursing, wouldn't be good enough, since that would just lead to a stack overflow on the original process, which is messy but can be dealt with.
A more human-friendly version looks like this:
kablammo() { # Declaration
kablammo | kablammo& # The problematic body.
}; kablammo # End function definition; invoke function.
Edit: William's comment below was a better wording of what I said above, so I've edited to incorporate that suggestion.
Can colon be used as identifier?
Yes, it can.
$ :()
> {
> echo "hello from : :)"
> }
$ :
hello from : :)
OSX Malicious Terminal Command (colon, brackets, curly brackets, apersand, etc)
It's a fork bomb. Don't do it. (Actually, as GB pointed out quickly, the copy here started out as a broken fork bomb. It was missing its final colon.) Still, if someone says, "Try this command" while snickering, and you don't know what it does, common sense says...
Edit: The one you have here is pretty famous as a work of art by Jaromil, a digital artist.
Kernel died with exit code 1(VS code)
This fix it from terminal
pip install pywin32==228
Related Topics
How to Permanently Export a Variable in Linux
What Is Better "Int 0X80" or "Syscall" in 32-Bit Code on Linux
Calling Printf in X86_64 Using Gnu Assembler
What Is an Uninterruptible Process
Linking Against an Old Version of Libc to Provide Greater Application Coverage
Error When Using Git Credential Helper With Gnome-Keyring as Sudo
Automating Running Command on Linux from Windows Using Putty
Can Awk Patterns Match Multiple Lines
Why Is a Tilde in a Path Not Expanded in a Shell Script
Shell Command to Tar Directory Excluding Certain Files/Folders
How to Find Out Line-Endings in a Text File
Makefiles With Source Files in Different Directories
How to Build & Install Glfw 3 and Use It in a Linux Project
How to Run a Perl Script as a System Daemon in Linux
How to Get Terminal'S Character Encoding
Avoid Gnome-Terminal Close After Script Execution