MacOS – the difference between -h, -r, -s, and -k, in the “shutdown now” command in single-user mode

macosshutdownsingle-user

So, I opened up single-user mode to show my friend how easy it was for a Mac to be directly hijacked if someone was able to steal the physical lap top (as opposed to hijacking remotely using SSH), and I couldn't exactly remember which shutdown now option to use (fortunately, I was prompted by the command line), so I defaulted to -h. Should I be worried if I use -h instead of -r? Is there any difference between these commands?

shutdown -h now
shutdown -s now
shutdown -r now
shutdown -k now

Best Answer

As stated in the shutdown manual page (man shutdownentered in a Terminal window):

 -h      The system is halted at the specified time.

 -k      Kick everybody off.  The -k option does not actually halt the
         system, but leaves the system multi-user with logins disabled
         (for all but super-user).

 -r      The system is rebooted at the specified time.

 -s      The system is put to sleep at the specified time.

So to shutdown the Mac the -h option is the proper one. -r restarts it and -s puts it to sleep. The -k option doesn't halt your system at all.