2013-11-14

Slitaz -- lsof

lsof (list open files)

How to find what program or service is listening on ports

1.
root@slitaz:/home/tux# lsof -Pnl +M -i4
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
dropbear 1406 0 3u IPv4 4317 0t0 TCP *:22 (LISTEN)
Xorg 1433 0 3u IPv4 4504 0t0 TCP *:6000 (LISTEN)
firefox 1539 1000 45u IPv4 32787 0t0 TCP 192.168.1.30:58613->173.194.72.189:443 (ESTABLISHED)

-P no port names
-l list UID numbers
-n no host names
-i select IPv[46] files
+|-M portMap registration (-)

2.
root@slitaz:/home/tux# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN 1433/Xorg
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1406/dropbear
root@slitaz:/home/tux#