I am in a LAN and there are 3 Ubuntu, 2 Kubuntu, 2 Windows XP and 2 Windows 7. What commands or tools are available to see what PCs are connected to the LAN that it shows the name of the PC and the IP. Similar to tools like Angry IP that show all PCs in a LAN.

Note that I do not know the IPs or names of the computers connected to the LAN. So the tool or command should look for them to.


9 Answers 9


Arp-scan works great for me too...

If using Wi-Fi:

sudo arp-scan -l --interface=wlan0

-or if using ethernet:

sudo arp-scan -l --interface=eth0

(this last is practically identical to what Rajesh Rajendran posted; the -l standing for --localnet)

If you don't have arp-scan (it doesn't come with Ubuntu by default), just pull up a terminal and type:

sudo apt-get install arp-scan
  • 5
    If this doesn't work use ifconfig to get a list of interfaces and try switching eth0 to something else. Commented Apr 21, 2017 at 15:29
  • 1
    It's not showing any IPs for me. sudo arp-scan -l --interface=wlp4s0 Interface: wlp4s0, datalink type: EN10MB (Ethernet) Starting arp-scan 1.9.5 with 256 hosts 14 packets received by filter, 0 packets dropped by kernel Ending arp-scan 1.9.5: 256 hosts scanned in 1.975 seconds (129.62 hosts/sec). 0 responded Commented Feb 4, 2020 at 1:56
  • how do I find the correct wifi interface? Mine is not wlan0 Commented Jul 2, 2020 at 15:11
  • arp-scan don't exist in Ubuntu 20.xx so this article are out of date and are only confusing people. Commented Aug 21, 2021 at 7:56
  • 1
    You can also sudo lshw -c network to see all your network interfaces
    – Chad
    Commented Jan 28, 2022 at 20:15

Taken from Finding All Hosts On the LAN From Linux/Windows Workstation

for ip in $(seq 1 254); do ping -c 1 192.168.1.$ip>/dev/null; 
    [ $? -eq 0 ] && echo "192.168.1.$ip UP" || : ;

But for a great tool, Nmap. Great for mapping networks.

  • 2
    this would work only when the subnet is using /24 addressing. Commented Nov 25, 2011 at 5:29
  • 7
    +1 That's a pretty spiffy little IP address scanner. Commented Aug 15, 2012 at 6:08
  • Your local IP may be very different than this...
    – JohnAllen
    Commented May 18, 2017 at 18:50
  • This only shows my default gateway IP Commented Feb 4, 2020 at 1:53

The simplest thing is

$ sudo arp-scan --localnet
  • 9
    arp-scan -l does the same thing.
    – ki9
    Commented Nov 7, 2016 at 3:35
  • I want a list of all the hosts. This doesn't do that. Commented Jul 2, 2020 at 14:55
  • I get ERROR: Could not obtain MAC address for interface tun0 Commented Feb 13, 2022 at 6:36

I always use nmap. To scan for all devices in your network, use:

nmap -sP

More here: https://www.cyberciti.biz/networking/nmap-command-examples-tutorials/

It is a great tool to know about. You may want to install nmap using:

sudo apt-get install nmap if you are using Debian or

sudo pacman -S nmap if you are using Arch.

  • What do to For Fedora?
    – supershnee
    Commented Aug 27, 2017 at 9:40
  • @supershnee Do a yum install nmap
    – Ruraj
    Commented Oct 27, 2017 at 17:41
  • And now for Fedora 25 and + : dnf install nmap will install nmap Commented Apr 3, 2018 at 12:51

As a possible GUI option, the best one I have seen is Angry IP as found in http://angryip.org/download/#linux

Simply download the latest DEB package and install. Then run ipscan from Dash. Here is a screenshot:

enter image description here

  • does it filter only linux machines, if yes please guide me how. Commented Apr 14, 2015 at 13:55
  • 1
    it is really good, I added all fetchers to the list columns, what helped most were hostname and macvendor, now everything connected to my wifi is more understandable, thx! Commented Oct 31, 2016 at 23:45
  • is wire shark better for tasks like this? how about kali linux? Commented Jul 2, 2020 at 15:12
  • @AquariusPower Where does one find the macvendor feature?
    – Jeff Ward
    Commented Jan 5, 2022 at 23:20
  • 1
    @JeffWard menu: tools/fetchers//availableFetchers//"lastItemOnTheList", then sort by macvendor, it is a short name of the hardware like D-Link Commented Jan 6, 2022 at 2:12


Address                  HWtype  HWaddress           Flags Mask            Iface
iPhone-von-me.fritz.box  ether   12:55:05:30:3c:df   C                     wlp3s0
android-abcdefghijklmno  ether   11:66:3f:71:04:d6   C                     wlp3s0
fritz.box                ether   00:11:3f:46:37:c2   C                     wlp3s0
Blupiblu.fritz.box       ether   71:88:cc:bb:dc:a6   C                     wlp3s0

ip neigh

ip neigh and hosts. NO nmap / sudo required.

Building on this, you can build a Python script:

#!/usr/bin/env python

"""List all hosts with their IP adress of the current network."""

import os

out = os.popen('ip neigh').read().splitlines()
for i, line in enumerate(out, start=1):
    ip = line.split(' ')[0]
    h = os.popen('host {}'.format(ip)).read()
    hostname = h.split(' ')[-1]
    print("{:>3}: {} ({})".format(i, hostname.strip(), ip))

Download via

wget https://gist.githubusercontent.com/MartinThoma/699ae445b8a08b5afd16f7d6f5e5d0f8/raw/577fc32b57a7f9e66fdc9be60e7e498bbec7951a/neighbors.py
  • the only output was: 1: _gateway. (207.23.10.xx4) where xx are digits Commented Jul 2, 2020 at 14:57

If broadcast isn't disabled on your router...

You can ping the broadcast address.

ping -b 192.168.0

Will broadcast the ping command to every host within the 192.168.0/24 subnet.

Note: It's probably a good idea to keep broadcasting turned off though as that's how hackers can exploit a network using a DDOS Smurf attack. Basically, ping the broadcast address with a packet that has a spoofed destination address (ie the ip address of the victim). There's a little more to it than that but that's what Google is for.

Note: The same also works on Windows but you ping the actual broadcast address (not the subnet).

ping -b

Nmap is your friend

nmap -sP

If you have any question, nmap help is full of information.

  1. Script to send email in Shell and Powershell where it is asked to user credentials when you run the script.

  2. Script to check online devices in the network for both Linux and Windows Clients.

  3. Script to check disk space of devices detected by previous script for both Windows and Linux.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .