LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-12-2011, 05:48 AM   #1
prakashsince92
Member
 
Registered: Jan 2010
Distribution: Ubuntu 10.10 Maverick
Posts: 37

Rep: Reputation: 0
Bash Command output


What does the following Shell program do ??

: () { :| : &} ; :


Warning: My computer got hung when i tried to execute this.

Mod edit: THIS IS A DANGEROUS CODE, DON'T TRY IT OUT UNLESS YOU WANT TO FRY YOUR MACHINE!

Last edited by colucix; 02-12-2011 at 06:10 AM.
 
Old 02-12-2011, 06:09 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
This a so called fork bomb. It's very dangerous since - as you already pointed out - it eagerly eats your resources and causes a machine to hang until you forcibly restart the computer. Sometimes system administrators use fork bombs to test the system limitations.

Regarding the shell code, it is a recursive function whose name is : (colon) and it supersedes the null command. The function code inside brackets calls itself twice through a pipe and put the process in background so that the child process cannot terminate. The semicolon is the command separator and the last colon actually starts the treacherous process.

I take the freedom to edit your post to warn users about the danger even more.
 
1 members found this post helpful.
Old 02-12-2011, 06:59 AM   #3
prakashsince92
Member
 
Registered: Jan 2010
Distribution: Ubuntu 10.10 Maverick
Posts: 37

Original Poster
Rep: Reputation: 0
Thank you !!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I get bash not to interpret the output of a backquote command? curieux Linux - General 1 10-13-2010 09:23 AM
[SOLVED] SQL Command output to bash variables chirayu11 Linux - Newbie 5 08-04-2010 08:40 AM
bash - output blank line after each command j0hnsmith Linux - General 2 10-22-2009 01:05 AM
Pass output of one command as input to another on bash linuxlover.chaitanya Linux - Newbie 3 01-08-2009 02:46 AM
Command output conrolling in bash pazvant Linux - Software 1 10-24-2003 08:01 AM


All times are GMT -5. The time now is 11:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration