What I love about OSX is its UNIX(-like) foundation. There are the default UNIX command line tools but also lots of OSX specific commands. This is a compilation of some of these commands you might not know. Feel free to comment.
This is a mere list of commands with a short description and one or two examples. To find out more of course use
Commands may destroy all your data or cause a nuclear meltdown — use only if you know what you are doing.
Configuration and networking
- Manage a variety of configuration stuff.
systemsetup -getcomputername # display computer name
- Execute Apple Software update from the commandline
sudo softwareupdate -i -a # install all available updates
- Manage the network configuration
sudo networksetup -switchtolocation home # switch network locations
- Directory service management, for example users, groups etc. – complex stuff, mostly for use on OSX server
- Manage DNS cache
- View system information (Like SystemProfiler.app in Utilities)
- Change file flags, like “hidden”, “archived”..
- View extended file attributes, like icon, creator and so on. To write these attributes use SetFileInfo
Disks and images
- Manage local disks
sudo diskutil repairPermissions / # repair permissions
- Manage disk images
hdiutil create -srcfolder path any.dmg # create dmg-image from folder
- Format a disk
- Interact with CD/DVD drives
drutil status # show detailed information about drives and media
- Open a file with a given application.
open . # opens a new finder window with the current commandline path
- Access OSX clipboard
- Manage Spotlight
- Take a screenshot
- Run Applescript from the shell
sudo osascript -e "set Volume 0" # set system volume to zero
- Manage QuickLook
- Run periodic system jobs
More in-depth information can be found here: