Finding the right ethernet jack using the command line



The goal: Identify which ethernet jack in a networking closet’s unlabeled patch panel corresponds to the ethernet port in your office or bedroom.

The problem: You’re blindly plugging your cable into different jacks, relying on either the router’s blinking lights or repeatedly walking back to your laptop to check for a network connection.

The solution: Run the following command in your MacBook’s1 terminal. It will continuously check for an internet connection and audibly announce its status, allowing you to test jacks without needing to walk back and forth. When you hear “connected” from the other room, you’ve found the right port!

while true; do ping -c1 -t1 1.1.1.1 >/dev/null 2>&1 && say "Connected" || say "Disconnected"; sleep 0.5; done

1

Linux users would need to replace say with something like speech-dispatcher 

← Return to home