nmap -n -p <PORT_NUMBER> \
--open <LOCAL_IP_RANGE>/24 \
-oG - \
| awk '/Up$/{print$2}'
Search for a computer using a specific TCP port with nmap
Personal
Linux

scans for the opened ports in local network

Description :

Searchs for a computer serving anything in a specific port

# -n : Never do DNS resolution/Always resolve
nmap -n -p <PORT_NUMBER> \
# --open : Only show open (or possibly open) ports
--open <LOCAL_IP_RANGE>/24 \
# -oG : Output scan in Grepable format, respectively, to the given file name
-oG - \ 
| awk '/Up$/{print$2}'

Displays the computer name for a given ip address

nmblookup -A <LOCAL_IP_ADDRESS>
Example :

Searchs for a computer serving anything in a specific port

nmap -n -p 8181 \
--open 10.162.246.0/24 \
-oG - \
| awk '/Up$/{print$2}'

Displays the computer name for a given ip address

nmblookup -A 10.162.246.5
2025 Jan