Linux

List all IPs/computers within the network in Linux

Well, this is a quick post and I’ve found the command on the net. It uses the nmap utility.

I found the solution here: http://superuser.com/questions/261818/how-can-i-list-all-ips-in-the-connected-network-through-terminal-preferably and uses one of the suggestion to use nmap. It works and it works perfect.

Given that you know the IP address of your own machine, you can then probe other machines connected within the network. To know what you’r IP address is, use ifconfig. If your IP address is 192.168.1.123, then use the command below:

root@darkstar:~# nmap -sP 192.168.1.0/24 

Starting Nmap 6.01 ( http://nmap.org ) at 2012-07-29 15:29 PHT
Nmap scan report for 192.168.1.1
Host is up (0.0025s latency).
MAC Address: 58:6D:8F:8A:C7:4D (Cisco-Linksys)
Nmap scan report for 192.168.1.145
Host is up (0.085s latency).
MAC Address: 9C:B7:0D:7D:2A:B7 (Liteon Technology)
Nmap scan report for 192.168.1.146
Host is up.
Nmap done: 256 IP addresses (3 hosts up) scanned in 6.61 seconds
root@darkstar:~# 

If your IP address is different, then let it be an exercise for you.

Share and enjoy.

Leave a reply

Your email address will not be published. Required fields are marked *