Shutdown UNIX Command

in Categories , last updated April 20, 2012

How do I shutdown or poweroff a UNIX computer system from a shell prompt?

You can use the halt, poweroff, and shutdown UNIX command line utilities. These command write any pending information to the disks and then stop the processor. The poweroff utility has the machine remove power, if possible. To shutdown UNIX computer immediately type the following command as the root user:
# halt
# poweroff
In this example, shutdown is being executed and is scheduled in 120 seconds. The warning message is output 2 minutes:
# shutdown -y -i 5 -g 120 "===== Disk replacement ====="
Under System V based systems, enter:
# shutdown -y -i 0 -g 10

  • -y : Pre-answer the confirmation question so the command can be run without user intervention.
  • -i init_Level : If there are warnings, init-state specifies the state init is to be in. By default, system state s (single user mode) is used. The -i 5 will shut the machine down so that it is safe to remove the power. The -i 0 will take into firmware on Sun and a few other Unix hardware.
  • -g graceTime : Allow the super user to change the number of seconds from the 60-second default.

To halt the HP-UX unix server system in 10 minutes (600 seconds) with no interactive questions and answers, enter as the root user:
# shutdown -h -y 300

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

Share this on (or read 1 comments/add one below):

1 comment

    Have a question? Post it on our forum!