Created
October 19, 2017 18:39
-
-
Save christopheranderton/c52ccd1a8355a7f449bfb5b6d831f829 to your computer and use it in GitHub Desktop.
CLI OS X/macOS: Shutdown, Restart and Sleep Commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Classic BSD Style | |
#--------------------------------------------------------------- | |
# Shutdown hardcore style | |
sudo shutdown -h now | |
# Shutdown at once hardcore style | |
sudo shutdown -r now | |
# Shutdown hardcore style in 30 minutes | |
sudo shutdown -h +30 | |
# Sleep | |
#--------------------------------------------------------------- | |
# Go to sleep | |
pmset sleepnow | |
# Put display to sleep | |
pmset displaysleepnow | |
# Using AppleScript in Terminal | |
#--------------------------------------------------------------- | |
# Shut down after showing a confirmation dialog | |
osascript -e 'tell app "loginwindow" to «event aevtrsdn»' | |
# Restart after showing a confirmation dialog | |
osascript -e 'tell app "loginwindow" to «event aevtrrst»' | |
# Log out after showing a confirmation dialog | |
osascript -e 'tell app "System Events" to log out' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment