osx

Command line

Processes

Disable Spotlight indexing because it steals all your damn CPU cycles

sudo mdutil -a -i off

CPU info, detailed

sysctl -a

Show the total size of the current directory (and all its subdirs)

du -c -h -s -c = grand total for all files -h = human-readable (KB, MB, GB, etc) -s = summarize = display only a total

Mounting an NTFS drive as read-write

sudo mount -v -t ntfs -o rw,auto,nobrowse /dev/disk3s1 /Volumes/Passport/

List all visible disks

diskutil list

Zeroing out a disk (safer than just formatting)

Misc

Location of iCloud Drive:

~/Library/Mobile\ Documents/com~apple~CloudDocs/ Use this for command line access to pull/push files like any other directory. OSX will take care of getting it uploaded to iCloud.

Creating app-specific passwords when you have 2FA enabled

Ex usage: accessing an iCloud calendar with Amazon Alexa Log on to https://appleid.apple.com/. Navigate to Security --> App-specific Passwords --> Generate You may want to take a screenshot of the password that gets generated because you will never be able to see it again

Change a user's default shell

sudo chsh -s /path/to/shell username

Source: https://superuser.com/questions/379725/how-do-i-change-a-users-default-shell-in-osx

Add user to a group

sudo dscl . append /Groups/wheel GroupMembership $USER will add current user to "wheel" group

Homebrew - installer for all the good stuff

  • Install packages: brew install <package>

  • Search for specific packages: brew search [--desc] <search term or regex>

  • Upgrade packages: brew upgrade

  • Upgrade one package: brew upgrade <package>

  • Getting help for any brew command: brew help <command>

More brew documentation available at https://docs.brew.sh

launchctl - Launch Control

Start, stop, enable, disable, unload from memory

See what services may be running

Just apple, or everything but apple

Turn off Symantec virus scanner until next reboot

Command line tools I should research further

ioreg - displays the I/O Kit registry. It shows the hierarchical registry structure as an inverted tree.

spctl - manages the security assessment policy subsystem.

Whatever that means.

kextstat -- display status of loaded kernel extensions (kexts)

Reference: Mentioned in https://www.silabs.com/community/interface/knowledge-base.entry.html/2018/03/30/usb_to_uart_bridgev-Dnef

ā€œUse your macOS terminal shell to do awesome thingsā€. https://github.com/herrbischoff/awesome-macos-command-line

dtruss - strace-ish tool

If you need to snoop on the activities of a command line tool, run dtruss <app> <app arguments>

Other tools are available from the DTrace package: execsnoop, iosnoop, iotop, opensnoop, rwsnoop, etc

OS X UI

Finder

Show/Hide hidden files

Shift + Cmd + .

Permanent delete one or more files

Option + Cmd + Delete

Empty trash

Shift + Cmd + Delete

System Preferences

Fix scrolling so it's correct (to me) and apparently unnatural (to Apple fans)

Trackpad --> Scroll & Zoom --> UNcheck "Scroll direction: Natural"

Enable SSH server

Sharing --> Remote login

Last updated