The Notebook Review forums were hosted by TechTarget, who shut down them down on January 31, 2022. This static read-only archive was pulled by NBR forum users between January 20 and January 31, 2022, in an effort to make sure that the valuable technical information that had been posted on the forums is preserved. For current discussions, many NBR forum users moved over to NotebookTalk.net after the shutdown.
Problems? See this thread at archive.org.

    Deadly Linux Commands

    Discussion in 'Linux Compatibility and Software' started by Leon, Nov 20, 2008.

  1. Leon

    Leon Notebook Deity

    Reputations:
    746
    Messages:
    1,552
    Likes Received:
    3
    Trophy Points:
    56
  2. Gintoki

    Gintoki Notebook Prophet

    Reputations:
    2,886
    Messages:
    6,566
    Likes Received:
    0
    Trophy Points:
    205
    Those are all fun commands I use on a daily basis! :p I know a couple they don't put up there but I won't post it here even with full warning because one not so smart person will be curios and cry their eyes out when their system is messed up.
     
  3. archer7

    archer7 Notebook Evangelist

    Reputations:
    289
    Messages:
    647
    Likes Received:
    0
    Trophy Points:
    30
    Something I've never had the courage to try:
    Code:
    # cat /dev/random > /dev/sda
     
  4. HankB

    HankB Notebook Geek

    Reputations:
    28
    Messages:
    89
    Likes Received:
    2
    Trophy Points:
    16
    I did something similar years ago trying to make a copy of the partition table. But I had the redirection backward. :eek:

    Surprisingly I was able to recover because I figured out I had screwed up before I tried to reboot. It's been a while, but ISTR recovery involved manually editing the MBR and partition table. Fortunately these are more or less well documented. I held my breath on the first reboot following that. ;)

    -hank
     
  5. Pitabred

    Pitabred Linux geek con rat flail!

    Reputations:
    3,300
    Messages:
    7,115
    Likes Received:
    3
    Trophy Points:
    206
    Code:
    pita@pita-t61:~$ :(){ :|:& };:
    [1] 30208
    pita@pita-t61:~$ bash: fork: Resource temporarily unavailable
    bash: fork: Resource temporarily unavailable
    bash: fork: Resource temporarily unavailable
    bash: fork: Resource temporarily unavailable
    bash: fork: Resource temporarily unavailable
    bash: fork: Resource temporarily unavailable
    bash: fork: Resource temporarily unavailable
    bash: fork: Resource temporarily unavailable
    bash: fork: Resource temporarily unavailable
    
    [1]+  Done                    : | :
    pita@pita-t61:~$
    
    Fork bombs don't do much of anything unless you have your system misconfigured ;) Check ulimit -a for info. You can edit /etc/security/limits.conf to add all kinds of system resource limits in.
     
  6. Gintoki

    Gintoki Notebook Prophet

    Reputations:
    2,886
    Messages:
    6,566
    Likes Received:
    0
    Trophy Points:
    205
    Is the fork bomb nonoperational with the default config in Ubuntu or does configuration need to take place?
     
  7. Pitabred

    Pitabred Linux geek con rat flail!

    Reputations:
    3,300
    Messages:
    7,115
    Likes Received:
    3
    Trophy Points:
    206
    It'll eat up a lot more processes by default, but you should be ok. The default limit is somewhere around 48000 processes, which is pretty high, but shouldn't nuke anything.
     
  8. archer7

    archer7 Notebook Evangelist

    Reputations:
    289
    Messages:
    647
    Likes Received:
    0
    Trophy Points:
    30
    These commands only become truly dangerous when run as root. The forkbomb is kinda unique in that it can incapacitate a machine with user access, but limits.conf can foil it easily. On the other hand, once you've got root you can pretty much tell the machine to brick and it will do so.
     
  9. Fittersman

    Fittersman Wanna trade?

    Reputations:
    225
    Messages:
    1,306
    Likes Received:
    0
    Trophy Points:
    55
    I don't get the forkbomb command. Why include a command that is just a bunch of symbols, call it a forkbomb and have it nuke your system (well, not nuke but you get what im saying)? Kind of like an anti-easteregg?
     
  10. archer7

    archer7 Notebook Evangelist

    Reputations:
    289
    Messages:
    647
    Likes Received:
    0
    Trophy Points:
    30
    It actually means something. The proper name for this thing is fork() bomb, and here's how it goes:
    Code:
    : ( ) { : | : & } ; :
    ' : ( )' creates a function called ' :' that executes the body stored in the curly brackets.

    ' : | :' is a recursive call to ' :' that pipes the output to another instance of ' :'. This makes it so that the processor is constantly used.

    The ' &' sends the process to the background, where it cannot be easily killed. This ensures that none of the child processes die.

    ' ; :' closes the function definition and initiates the first call to ' :', e.g. it sets up the parent process which will flood your system with its children.

    As you can see, the function's name doesn't have to be ' :'. It can be Sammy for all you care, ' :' just looks way more intriguing.
    Code:
    sammy ( ) { sammy | sammy & } ; sammy
    P.S. It turns out that fork() bombs are legally DoS attacks.

    P.P.S. There seems to be a somewhat subtler threat to the fork() bomb: running out of PIDs. Haha, it's kinda fun having a brain-dead interface.
     
  11. Patrick

    Patrick Formerly beat spamers with stiks

    Reputations:
    2,284
    Messages:
    2,383
    Likes Received:
    93
    Trophy Points:
    66
    Fork bombs are how I reboot the windows computers at my school. Its just so much easier that way.
     
  12. Hates BSOD

    Hates BSOD Notebook Consultant

    Reputations:
    8
    Messages:
    126
    Likes Received:
    0
    Trophy Points:
    30
  13. focusfre4k

    focusfre4k Notebook Evangelist

    Reputations:
    149
    Messages:
    569
    Likes Received:
    0
    Trophy Points:
    30
    sudo rm -rf /

    tada!
     
  14. millermagic

    millermagic Rockin the pinktop

    Reputations:
    330
    Messages:
    1,742
    Likes Received:
    0
    Trophy Points:
    55
    Can't you just hold the power button?
     
  15. Thomas

    Thomas McLovin

    Reputations:
    1,988
    Messages:
    5,253
    Likes Received:
    0
    Trophy Points:
    205
    That's much less fun.
     
  16. Enunes

    Enunes Notebook Consultant

    Reputations:
    156
    Messages:
    204
    Likes Received:
    0
    Trophy Points:
    30
    Lol, forkbomb worked here...

    that was fun, though.

    Can i do it via ssh? :D Will try it later. We have ssh enabled at college pcs, that will also be fun.

    Btw, good post! :)
     
  17. Pitabred

    Pitabred Linux geek con rat flail!

    Reputations:
    3,300
    Messages:
    7,115
    Likes Received:
    3
    Trophy Points:
    206
    Depends on how competent your admins are. You should be able to run a forkbomb as a normal user on ANY system and not have it kill the machine.
     
  18. lemur

    lemur Emperor of Lemurs

    Reputations:
    524
    Messages:
    1,024
    Likes Received:
    0
    Trophy Points:
    55
    Darn right:

    Code:
    brick(8)                                                                                brick(8)
    
    NAME
           brick - bricks a system
    
    SYNOPSIS
           brick [OPTIONS]
    
    DESCRIPTION
           If you are not root, brick does nothing.  On the other hand, once 
           you've got root you can pretty much tell the machine to brick and 
           it will do so.
    
    OPTIONS
           -p       Requests that the brickage be permanent.  Without -p,
                    brick will render the machine nonfunctional but resintalling
                    the OS will restore functionality.  With -p, brick will attempt
                    to completely mess up any kind of on-board firmware so that
                    the system remains permanently bricked.
    
    NOTES
           Do not use on production systems. 
    
     
  19. Amranu

    Amranu Notebook Consultant

    Reputations:
    103
    Messages:
    233
    Likes Received:
    0
    Trophy Points:
    30
    rofl, awesome
     
  20. pixelot

    pixelot Notebook Acolyte

    Reputations:
    3,732
    Messages:
    6,833
    Likes Received:
    0
    Trophy Points:
    205
    Been there, done that. :p :D
     
  21. Innova

    Innova Notebook Geek

    Reputations:
    0
    Messages:
    79
    Likes Received:
    0
    Trophy Points:
    15
    I was going to reformat my Linux partion and reinstall, so once I backed everything up, I thought it would be fun to run this command. Unfortunately, my windows partition (which I hadn't fully backed up) was mounted under /mnt. Fortunately, I remembered this soon enough and killed the command before I lost anything.