avatar Kisaragi Hiu

Linux: Finding devices on the same network

I know when I share my phone's mobile internet to my laptop through WiFi tethering, the two devices are in the same network and can see each other. But how do I find out the local IP address of the other device?

After a little bit of Googling, like this:

nmap -sn

This is the result:

Starting Nmap 7.92 ( https://nmap.org ) at 2022-03-15 01:53 JST
Nmap scan report for
Host is up (0.00024s latency).
Nmap scan report for
Host is up (0.0059s latency).
Nmap done: 256 IP addresses (2 hosts up) scanned in 6.48 seconds

This means it has found two devices on the local network:


What ip address returns, with irrelevant parts removed:

ip address

3: wlp6s0: […]
    inet brd scope global dynamic noprefixroute wlp6s0
       valid_lft 2847sec preferred_lft 2847sec
    inet6 fe80::d3d:871a:3b5b:24bb/64 scope link noprefixroute
       valid_lft forever preferred_lft forever