For most people, the Mac's OS X is all about the graphical user interface. But system administrators and power users know that the Mac's command-line interface can be a powerful time saver and, in many cases, the only method to accomplish certain tasks. The command shell itself, delivered by Apple's included lTerminal program, is a wonder of open source. Bash -- for "Bourne again shell" -- was developed by free-software guru Brian Fox. It's widely used on operating systems of all kinds, including iOS, Linux, Unix, and mainframes. There's already a huge brain trust of tool knowledge around using Bash as a systems administrator's command shell.
But OS X brings its unique capabilities to the command-line table, in the form of utilities that leverage OS X's user interface, file system, and security capabilities. I've scoured the Internet for the best of the best of these utilities. Some you may already know, but others are sure to make you sit up and exclaim, "Sweet!"
[ For tips and tools on managing an enterprise Mac fleet, download InfoWorld's free "Business Mac" Deep Dive PDF special report today. | See InfoWorld's slideshow tour of OS X Mountain Lion's top 25 features and test your Apple smarts with our Apple IQ test: Round 2. | Keep up with key Apple technologies with the Technology: Apple newsletter. ]
What follows is an alphabetical list of the 20 best command-line gems, with enough description to put you on the path to using their productivity riches. All commands, unless otherwise noted, run on all versions of OS X since 10.4 Tiger. For most of these commands, you can get more documentation using the "manpage" system: Type
man followed by the command name. For example,
man lsof displays the manual page for the List Open Files command.
When you click the Wi-Fi icon in OS X's menu bar (called AirPort before OS X Lion), you get a list of available wireless networks. The
airport command-line utility does the same and a lot more. It shows you the numeric signal strength for every access point, the channel used, and the encryption level, if any.
airport command-line utility is buried deep in the System directory (aka System folder when using OS X's GUI). But you can create a symbolic link to it using the one-time command below. Then just type
airport -s in the Terminal's command line to get the detailed scan report. (Hint: If you don't get any output, turn Wi-Fi on in the Network system preference.)
To create a symbolic link to the
$ sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport
To run a wireless scan:
$ airport -s
SSID BSSID RSSI CHANNEL HT CC SECURITY (auth/unicast/group)
air4 90:84:0d:c2:c2:c2 -74 1 Y US WPA2 (PSK/TKIP/TKIP)
MY408G1 00:26:b8:c2:c2:c2 -82 6 Y US WEP
air4 00:24:36:c2:c2:c2 -27 11 Y US WPA (PSK/TKIP/TKIP)
G00NOO7 00:18:01:c2:c2:c2 -70 11 N US WEP
air4 5G 90:84:0d:c2:c2:c2 -87 36,+1 Y US WPA2 (PSK/AES,TKIP/TKIP)
air4 5G 00:24:36:c2:c2:c2 -35 157,+1 Y US WPA2 (PSK/AES,TKIP/TKIP)