Nathan Belete
Nathan Belete

Reputation: 9

Raspberry pi 2 Hostapd Get list of users

So I set up my raspberry pi 2 with a hostapd that casts out an access point using my wlan0 interface along with dnsmasq and apache2 as my defualt browser. Now when i did this a year ago i could type the command:

arp -a

and it would show a list of the users that are on my network as such:`

*USERS NAME* 10.0.0.142 *mac adress*

along with other details. However, when i do it now, it only shows the ip address that they are on and the usual detail except for the users device name. instead of a device name i am shown "?" for all of the devices that are connected. I know my question might be a bit hard to follow but i hope someone can answer this question. Thank you.

Upvotes: 0

Views: 4659

Answers (1)

Abdulkader Khateeb
Abdulkader Khateeb

Reputation: 107

You can print only Hostname of connected devices using the command:

arp | cut -d ' ' -f 1 | sed '1d'

it's better to add it to your aliases by editing the file .bashrc:

cd ~
sudo nano .bashrc

then press Ctrl+W and type alias to look for it, then you simply can insert your alias (at the end of system aliases) with desired name:

alias clients="arp | cut -d ' ' -f 1 | sed '1d'"

NOTE: be sure to use double quotations to enclose the command, or you can precede every single quotation with backslash \' in this case there is no need for "

Upvotes: 0

Related Questions