macOS - shell commands and keyboard shortcuts #bash #macOS
# If you‘re asked to click Connect before reconnecting to a server
# https://support.apple.com/en-us/HT207112
sudo defaults write /Library/Preferences/com.apple.NetworkAuthorization AllowUnknownServers -bool YES
sudo defaults delete /Library/Preferences/com.apple.NetworkAuthorization AllowUnknownServers
# Put screen to sleep
Control + Shift + Eject/Power
# macOS show invisibles in open dialog
Command + Shift + Period
# Bash - finder, dock and show-hide hidden files
# Finder
killall -KILL Finder
# Dock
killall -KILL Dock
# Menubar
killall -KILL SystemUIServer
# Notification Center
killall -KILL NotificationCenter
# Hide/Show hidden files
defaults write com.apple.finder AppleShowAllFiles -bool NO && killall Finder
defaults write com.apple.finder AppleShowAllFiles -bool YES && killall Finder
# Show hidden files in open/save dialogs
defaults write -g AppleShowAllFiles -bool true
# Hide/show Desktop
defaults write com.apple.finder CreateDesktop -bool false && killall Finder
defaults write com.apple.finder CreateDesktop -bool true && killall Finder
# Hide/show files/folder
chflags hidden /path/to/folder/
chflags nohidden /path/to/folder/
# Disable System Integrity Protection
# https://www.howtogeek.com/230424/how-to-disable-system-integrity-protection-on-a-mac-and-why-you-shouldnt/
# Boot into recover mode `Command+R` and select Terminal from the Utlities pull-down
csrutil status
csrutil disable
csrutil enable