MacOS Command Line
☰ Table of Content
Some MacOS commands and keyboard shortcuts.
Keyboard Shortcut
Shortcut | Description |
---|---|
Command+. or esc | Click cancel in dialog |
Command+d | Click Don't Save in dialog |
Command+tab | Switch app |
Command+m | Minimize app |
Command+h | Hide app (not minimize) |
Command+` | Switch window of the same app |
Command+, | Open preference of most app |
Command+w | Close active tab of an app |
Command+q | Close active app |
Command+b | Toggle sidebar in app |
Command+option+left/right | Switch tab in app |
Command+shift+. | Show hidden file in finder |
Desktop Space
Shortcut | Description |
---|---|
Ctrl+Up Arrow | Select space |
Ctrl+Down Arrow | Return to desktop |
Un-minimize
Shortcut | Description |
---|---|
Command+tab -> (do not release Command) -> Command+option+return | Un-minimize app |
Run Application from Command Line
Application name is case-sensitive. Use tab for auto-complete.
|
|
Launch Control
List all services
1 2 3
launchctl list # List services launchctl load <plist file> # Start service launchctl unload <plist file> # Stop service
List all 3rd-party(non-Apple) services
1
launchctl list|grep -v com.apple.
System Service Location
/Library/LaunchDaemons/
/System/Library/LaunchDaemons/
Memory Usage
Result is in page number. Multiply with page size show at the top.
|
|
Kernel Extension
List all kernel extension
1
kextstat
List all non-Apple extension
1
kextstat | grep -v com.apple
Plist Content
|
|
Safe Mode
Hold down Shift during boot.
Command line may not work anymore.
Enable
1 2
sudo nvram boot-args="-x" sudo nvram boot-args="-x -v"
Disable
1
sudo nvram boot-args=""
Network Setup Command
Help
1
networksetup
List all network service
1
networksetup -listallnetworkservices
Turn network service on/off
1 2 3
networksetup -setnetworkserviceenabled <networkservice> <on off> networksetup -setnetworkserviceenabled Ethernet off networksetup -setnetworkserviceenabled Ethernet on
Change Hostname
|
|
Mouse Speed
Get
1
defaults read -g com.apple.mouse.scaling
Set
May need reboot.
1
defaults write -g com.apple.mouse.scaling your_mouse_speed
dns-sd (mdns/avahi/bonjour)
Get address of hostname
|
|
Play Audio
|
|
John Siu
Update: 2023-07-12