I connect my hotspot through ap-hotspot and I can see the notifications pop out displaying new device connected , device disconnected. (Because I want to learn about privileges for access to use or not use the hotspot.)

How can I list the device connected through terminal?

share|improve this question
up vote 18 down vote accepted

arp -a should return you a list of all connected devices.

share|improve this answer
3  
also arp -an is useful --- to avoid long delays trying to resolve IP addresses. – Rmano Dec 27 '14 at 11:38
    
arp does not update real time – Luis Jul 21 '16 at 7:59

I connected my phone to the network and used the awesome Fing app to scan the clients connected :)

https://play.google.com/store/apps/details?id=com.overlook.android.fing&hl=es

https://itunes.apple.com/es/app/fing-esc%C3%A1ner-de-red/id430921107?mt=8

share|improve this answer

Show a list of devices: (replace <interface> with the interface name of your wifi interface)

iw dev <interface> station dump

If you don't know the name of your wifi interface, use this command to find out the interface name:

iw dev
share|improve this answer
    
While this answer is good in its current state, it could still be improved. Perhaps you can add some example output or otherwise explain more as to what this command does? – Kaz Wolfe May 21 '17 at 20:21

If you want a more detailed list, I adapted this script for the ap-hotspot script that comes from webupd8:

#!/bin/bash

# show_wifi_clients.sh
# Shows MAC, IP address and any hostname info for all connected wifi devices
# written for openwrt 12.09 Attitude Adjustment
# modified by romano@rgtti.com from http://wiki.openwrt.org/doc/faq/faq.wireless#how.to.get.a.list.of.connected.clients

echo    "# All connected wifi devices, with IP address,"
echo    "# hostname (if available), and MAC address."
printf  "# %-20s %-30s %-20s\n" "IP address" "lease name" "MAC address"
leasefile=/var/lib/misc/dnsmasq.leases
# list all wireless network interfaces 
# (for MAC80211 driver; see wiki article for alternative commands)
for interface in `iw dev | grep Interface | cut -f 2 -s -d" "`
do
  # for each interface, get mac addresses of connected stations/clients
  maclist=`iw dev $interface station dump | grep Station | cut -f 2 -s -d" "`
  # for each mac address in that list...
  for mac in $maclist
  do
    # If a DHCP lease has been given out by dnsmasq,
    # save it.
    ip="UNKN"
    host=""
    ip=`cat $leasefile | cut -f 2,3,4 -s -d" " | grep $mac | cut -f 2 -s -d" "`
    host=`cat $leasefile | cut -f 2,3,4 -s -d" " | grep $mac | cut -f 3 -s -d" "`
    # ... show the mac address:
    printf "  %-20s %-30s %-20s\n" $ip $host $mac
  done
done

copy it in a file in your PATH --- for example ~/bin/show_wifi_clients, make it executable with chmod +x, and enjoy.

share|improve this answer
    
A nice an crazy script, thanks for sharing, :)... – George Udosen Jan 24 '17 at 20:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.