How to shutdown or reboot Solaris, Linux, AIX or HPUX

[Solaris] [Linux] [AIX] [HPUX] [Windows] [MacOS]


Solaris

Table 1 — Solaris shutdown and reboot commands
Action Command(s)
Shutdown# shutdown -y -g0
# sync;sync;init 5
Poweroff# shutdown -y -i5 -g0
# poweroff
Reboot# shutdown -y -i6 -g0
# sync;sync;init 6
# reboot

shutdown command options:

    • -y — Pre-answer the confirmation question so the command can be run without user intervention.
    • -i <init-state> — init-state specifies the state init is to be in. By default, system state 's' is used.
    • -g <grace-period> — Allow the super user to change the number of seconds from the 60-second default.

Linux

Table 2 — Linux shutdown and reboot commands
Action Command(s)
Shutdown# shutdown
Cancel a shutdown# shutdown -c
Poweroff# poweroff
Reboot# shutdown -r now
# reboot

shutdown options:

    • By default the shutdown command will bring the OS to runlevel 1.
    • now — perform shutdown immediately, default shutdown is 60s

AIX

Table 3 — AIX shutdown and reboot commands
Action Command(s)
Shutdown# shutdown
# shutdown now
# shutdown -F
Reboot# shutdown -r
# shutdown -Fr
# reboot

shutdown options:

    • Default shutdown is 60s
    • -r — reboot - flush cache to disk.
    • -F — forcefully.

HP-UX

Table 4 — HP-UX shutdown and reboot commands
Action Command(s)
Shutdown# shutdown -h -y now
# shutdown -h -y 0
Reboot# shutdown -r -y now
# shutdown -r -y 0

shutdown options:

    • 0 — 0 is grace period in seconds.

Microsoft Windows

Table 5 — Microsoft Windows shutdown and reboot commands
Action Command(s)
ShutdownC:\> shutdown /s
C:\> shutdown /s -t 60
RestartC:\> shutdown /r
C:\> shutdown /r -t 60

shutdown options:

    • -t 60 — perform action in 60 seconds, default is immediately.

MacOS X

Table 6 — MacOS X shutdown and reboot commands
Action Command(s)
Shutdown# sudo shutdown -h
# sudo shutdown -h now
# sudo halt
# osascript -e 'tell app "System Events" to shut down'
Reboot# shutdown -r
# shutdown -r now
# osascript -e 'tell app "System Events" to restart'

shutdown options:

    • now — perform action immediately, default is 60s.
    • +30 — perform action in 30 minutes.