Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to shutdown my computer as if power was cut off (don't ask me why). How do I do this under Linux?

share|improve this question

migrated from stackoverflow.com Sep 30 '10 at 20:18

This question came from our site for professional and enthusiast programmers.

4  
Pull the power plug? :) – Bryan Sep 30 '10 at 20:10
    
And you know that there's a difference between "init 6" and cutting the power off?! You should decide which of your two questions you want to be answered. – AndiDog Sep 30 '10 at 20:13
    
@Bryan: Won't work on a laptop, so you'd also have to remove the battery. – David Thornley Sep 30 '10 at 20:15
    
I meant init 0. I can't edit the question. – Alexandru Sep 30 '10 at 20:39
up vote 7 down vote accepted

If your system has it, the poweroff command should do it:

poweroff -n -f

  -n = don't sync
  -f = don't run shutdown
share|improve this answer
    
Interesting, but my man page for poweroff doesn't list -n (not that it's needed). – TomMD Sep 30 '10 at 20:17
    
My man page for poweroff does list these options :-). Debian squeeze/stable. – sleske Feb 14 '11 at 23:18

you can echo 'o' (poweroff) to /proc/sysrq-trigger:

$ echo o | sudo tee /proc/sysrq-trigger
share|improve this answer
    
This is one of the better options if your hard disks failed. In such a case, you'll get an I/O error running the poweroff command. – i_grok Nov 16 '12 at 18:09

you could just panic it, depending on what you wish to achieve.

sysctl -w kernel.panic=1
share|improve this answer
    
That's even better than I had in mind. – Alexandru Sep 30 '10 at 20:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .