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

link|improve this question
4  
Pull the power plug? :) – Bryan Sep 30 '10 at 20:10
This belongs on superuser.com. 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
feedback

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

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

6 Answers

up vote 5 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
link|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
feedback

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

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

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

$ echo o | sudo tee /proc/sysrq-trigger
link|improve this answer
feedback

init 6 is for reboot

you can use reboot or poweroff commands

link|improve this answer
feedback

shutdown -t now should do the trick.

link|improve this answer
1  
That will still run any tasks in runlevel 0. – Powerlord Sep 30 '10 at 20:12
feedback

I prefer the command halt.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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