macOS command-line tools you might not know about

rw-book-cover

Metadata

Highlights


caffeinate - set Mac sleep behavior Running caffeinate with no flags or arguments prevents your Mac from going to sleep as long as the command continues to run. caffeinate -u -t <seconds> prevents sleep for the specified number of seconds. Adding the -d flag also prevents the display from going to sleep. Specifying an existing process with -w <pid> automatically exits the caffeinate command once the specified process exits. (View Highlight)


mdfind - search with Spotlight mdfind <query> performs a keyword-based Spotlight search with the given query. mdfind -name <name> searches for all files matching the given name. The -onlyin <dir> flag restricts the search to the given directory. (View Highlight)


networkQuality - measure Internet speed Run networkQuality to run an Internet speed test from your Mac. Add the -v flag to view more detailed information. (View Highlight) Checking Network Quality Checking Download Speed


sips - image manipulation sips -z <height> <width> <image> resizes the specified image, ignoring the previous aspect ratio. sips -Z <size> <image> resizes the largest side of the specified image, preserving the aspect ratio. sips -r <degrees> <image> rotate the image by the specified degrees. (View Highlight) Image Resizing


softwareupdate - manage OS updates softwareupdate --list prints out available software updates. sudo softwareupdate -ia installs all available updates. (View Highlight)