Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've a home server I'm playing around with :) I want to learn server administration...

I have hard time understanding difference between shutdown -h now and poweroff -h now My logic tells me it's the same thing...

But with shutdown, linux halts, and power stays on - I can see all lights up and cooler rotating. Strange, only way to turn off my box completely is to use poweroff -h

any clarification will be appreciated.

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

The answer is in the poweroff(8) man page:

When called with --force or when in runlevel 0 or 6, this tool invokes the reboot(2) system call itself and directly reboots the system. Otherwise this simply invokes the shutdown(8) tool with the appropriate arguments.

A bit of explanation:

  • The reboot() system call is the kernel function used to reboot, halt or poweroff the machine. It is called reboot for historical reasons, but performs all three functions, depending on parameters that are passed to it.

  • The difference between "halt" and "poweroff" is that in "halt" mode the control is returned to a "ROM monitor" (think BIOS), whereas "poweroff" simply powers the system board off. (I have never seen this distinction in effect on PC architectures; on Sun machines it's different, though.)

  • So, when the poweroff program is invoked when the Linux system is in runlevel 0 or 6, it will immediately power off the system (via the reboot(RB_POWEROFF) system call)

  • In any other case, poweroff will just behave as an alias for shutdown -P now.

share|improve this answer
3  
I'm not so good at reading technicalities. I still don't get the difference. I might be stupid, but for me reboot is reboot. I don't get why power-off has to reboot anything... –  Sandro Dzneladze Oct 9 '11 at 22:18
    
@SandroDzneladze I've added an explanation; hope it's more clear now. –  Riccardo Murri Oct 10 '11 at 8:51
    
It's awesomely clear :) thanks for your time... really! –  Sandro Dzneladze Oct 10 '11 at 15:32
add comment

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.