How to see all computers connected to a network

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.


Solution 1:

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

Solution 2:

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" || : ;
done

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

Solution 3:

The simplest thing is

$ sudo arp-scan --localnet