The Mac OS X Terminal offers Apple administrators the ability to unlock the power of the command line, enter basic directory commands, navigate the Mac shell and much more. Mac Terminal commands, of course, are old hat to seasoned UNIX professionals, but many users and even some administrators thrust into technical supporting roles may not be familiar with basic shell commands. Here’s a quick review of three networking commands Mac professionals can employ to become more effective troubleshooters.


Computers, both laptops and desktops, are frequently passed around an organization. It’s common for one system to be used by several different staff members during the computer’s life cycle. When troubleshooting network connections, or just confirming you’re troubleshooting the correct computer when addressing file-sharing problems, use the hostname command to confirm the system’s computer name.

From the Mac Terminal, found within the Applications folder’s Utilities subfolder, type hostname -s to display (print) onscreen the system’s computer name. Used without the -s switch, entering just the hostname command and pressing Enter prompts OS X to display the network computer name.

For example, if a Mac’s computer name is Accountant and the computer is installed on a network leveraging the .local suffix, running the hostname command will return the result Accountant.local. Running the hostname -s command on the same machine will return the result Accountant.


Organizations frequently select a user’s name for use as the Mac computer name. In other words, when Jane receives a new Mac the computer is named Jane. But what happens later when Jane leaves the firm and is replaced by Greg? Greg ends up using a computer named Jane. In the words of Internet sensation Sweet Brown, “ain’t nobody got time for that.”

Greg likely and understandably will desire a better and more accurate computer name, such as accountant (if he’s an accountant) or another description better suited to his role. The scutil command enables permanently changing a Mac’s computer name. Enter sudo scutil –set ComputerName Accountant to change a Mac’s computer name to Accountant. Note, the sudo command is a super user or administrative-level command that requires entering a system administrator password to proceed.

The scutil system configuration utility assists troubleshooting DNS problems. Typing scutil –dns within OS X’s Terminal generates name server, domain, and timeout data, among other information, for the system upon which the command is run. Mac users can also use the scutil command to test connectivity to another system (using the command text scutil -r or scutil -r Ultimately, using a vast range of options, the scutil command provides a wealth of network troubleshooting capacity.


Often, when troubleshooting network connection issues, an administrator struggles to determine or confirm the numeric IP address assigned to a remote system. The host command can help.

Say an administrator is working to troubleshoot website or email connectivity and/or configuration. Entering host within a Terminal window generates detailed DNS information for the domain.

Among the information the host command returns for the location the user enters are WAN IP addresses, the IPv6 WAN address, and the mail handling addresses. The support for numerous options makes the command an incredibly powerful troubleshooting utility. For example, if the administrator sought only to troubleshoot mail flow problems, using the -t option by entering host -t MX, would limit the results to just the mail handling information. Administrators can then employ the resulting information to perform additional DNS, ping, and network tests and further isolate and diagnose errors.

Just a sampling

These are just a sampling of OS X’s networking command tools. Numerous other commands exist, which assist users and administrators alike in diagnosing and repairing connectivity problems. The more users and administrators become familiar with the command line, and common network troubleshooting commands, however, the more their skills and expertise will grow.