List open program with lsof
Jun 20
To list open program listening port as well as what program is running and the connection, run the following command: -
lsof -i :22
Output of the command: -
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
sshd 1468 root 3u IPv4 1626 TCP *:ssh (LISTEN)
sshd 1900 root 4u IPv4 487285 TCP 192.168.1.1:ssh->192.168.1.2:2986 (ESTABLISHED)
To list all open program listening port, run the following command: -
lsof | grep LISTEN
Output of the command: -
sshd 2071 root 3u IPv6 6511 TCP *:ssh (LISTEN)
sendmail 2111 root 4u IPv4 6671 TCP localhost.localdomain:smtp (LISTEN)
Twitter
Facebook
Flickr
RSS
Recent Comments