Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

3 Answers 3

up vote 6 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.