Skip to content

Mac OS Terminal

A-Z Index of Apple macOS (bash) commands

ss64.com/mac

Some usefull commands

Open a Folder from Terminal

cd to directory, then

open .

Create a File in a Folder

cd to directory, then

touch Filename.md

to creat a Markdown file with name "Filename"; use Filename.txt for a text file etc.

Prevent Mac laptop from turning on when opening its lid or connecting to power

Prevent startup when opening the lid or connecting to power:

sudo nvram BootPreference=%00

Prevent startup only when opening the lid:

sudo nvram BootPreference=%01

Prevent startup only when connecting to power:

sudo nvram BootPreference=%02

Undo any of the previous commands:

sudo nvram -d BootPreference

Adjust Mac Menu Bar Whitespace

You can modify the default padding and spacing between elements in the Mac menu:

defaults -currentHost write -globalDomain NSStatusItemSelectionPadding -int 6
defaults -currentHost write -globalDomain NSStatusItemSpacing -int 6

Revert to the original values defaults -currentHost delete -globalDomain

NSStatusItemSelectionPadding defaults -currentHost delete -globalDomain NSStatusItemSpacing

airport / WiFi

Get details about your current wireless network / WiFi connection.

/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I

arp

Get all IP Adresses in a Network

arp -a

curl

Get my public IP address, or IP adress with details:

curl ip.network
curl ip.network/more