Terminal tools speak in device names like en0 and en7. System Settings speaks in Wi-Fi and Ethernet. This command translates between the two.
Run it without sudo:
networksetup -listallhardwareports
For every port you get three lines: the hardware port name, the device and its Ethernet (MAC) address. A typical block looks like this:
Hardware Port: Wi-Fi
Device: en0
Ethernet Address: 02:00:00:aa:bb:cc
On a MacBook, en0 is usually Wi-Fi, but don’t count on it on a Mac mini or iMac with a built-in Ethernet port, or once docks and adapters come into play. A USB or Thunderbolt Ethernet adapter gets its own device name, and each new adapter can get a new one.
That’s when this list pays off. A command like ipconfig getifaddr en5 or a firewall rule in a tool needs the right device, and here you can see which one it is. The MAC address is handy too, for a DHCP reservation in your router.
The list shows ports, not whether they’re connected. For the live state of a device, ifconfig en5 tells you if it’s active. And if you plug in a new adapter and it’s missing from the list, the man page has -detectnewhardware, which needs admin rights, so I’d simply try System Settings first.
Further reading: networksetup.8 man page