syntax
launchctl reboot [system|userspace|halt|logout|apps]
restart
sudo launchctl rebootorsudo launchctl reboot systemlaunchdwill make thereboot(2)system call when userspace has been completely torn down. The same as therestartoperation from theApplemenu.sudo launchctl reboot userspaceWith the userspace argument given, launchd will re-exec itself when userspace has been torn down and bring userspace back up. This is useful for rebooting the system quickly under conditions where kernel data structures or hardware do not need to be reinitialized. A little fasterrestartbut there are sometime bugs, I think, such as missing external disk or reverting the default shell fromzshtobash.
shutdown
launchctl reboot halt
launchd will make the reboot(2) system call when userspace has been completely torn down and pass the RB_HALT flag, halting the system and not initiating a reboot. The same as the Shut Down operation from the Apple menu.
logout
launchctl reboot logout
launchd will tear down the caller's GUI login session in a manner similar to but much faster than a logout initiated from the Apple menu. Only use it when you know you have no unsaved data in your running apps.
Terminate all user apps
launchctl reboot apps
launchd will terminate all apps running in the caller's GUI login session that did not come from a launchd.plist(5) on-disk. Apps like Finder, Dock and SystemUIServer will be unaffected. It's very fast but still no confirmation to unsaved data.