It is possible that on some occasion you have wanted to know the IP of a device connected to the network, or perhaps just get a list of all connected stations to see for example if there are any intruders. There are several ways to do it, such as looking at the router, but without a doubt the fastest is by executing a command in the OS X Terminal.
Advanced commands
Thanks to UNIX power and from the utility of the broadcast address of our subnet, we can obtain a command with which we will obtain the list of connected stations almost instantly. The command makes a request for all network devices to respond by pinging, to later filter the information (grep) and display it more clearly and easily, as you can see in the screenshot.
The command in question is the following:
ping -c 3 192.168.1.255 | grep 'bytes from' | awk '{print $ 4}' | sort | uniq
Always assuming that your network is 192.168.1.X. If your network is 192.168.0.X or another modification you have to change the command to make it work, as is logical.
It is not something that you will use everyday or a utility that saves your life, but maybe sometime you need it (especially if you use DHCP) and then it will be great.
More information - What to do if your Mac doesn't use the maximum WiFi speed
It doesn't work, it gives me an error "grep: from ': No such file or directory"
What am I doing wrong?
You have not done anything wrong, just the command as it is written does not work.
Change the quotes to single quotes
Hello, if the command served me, thank you very much!
ping -c 3 10.0.1.255 | grep 'bytes from' | awk '{print $ 4}' | sort | uniq
The command:
arp -a
It does the same.
Greetings.