How to use the Terminal to test Network Connection on Mac
Every so often, you will want to check and see if a network is connected to the Internet. Â Their is a quick Terminal command that will let you do just that called ping. Â This command will work with all versions of Linux, Unix, Mac OS X, MacOS, and some versions of Microsoft Windows via the DOS prompt (Start > Run > Command.com).Â
Here’s how to use it:
- Open a terminal window (Finder > Applications > Utilities > Terminal).
- Type: ping www.apple.com
The above command will send 10 packets of information to the above domain. Â If the computer is connected to a network, it will return detailed information about the response time. Â If, however, the computer is not connected to a network, then the packet information will return an error.
By the way, the ping command can include a name of a web site, or its IP address.  It can also come in handy if you wanted to ping a local computer as long as you know its IP address.
Like so:
- ping 192.168.0.5
- ping CNN.com
- ping 123.456.7.8