Tidy list of what’s listening on your ports

This chunk of code will show you a nice list of ports on which you have something listening.


#!/bin/sh
# listen - parse netstat -an output for listeners
netstat -an | awk '
BEGIN {
printf("%12s\t%5s\t%5s\n", "ADDRESS", "PROT", "PORT#")
printf("%12s\t%5s\t%5s\n", "-------", "----", "-----")
}
/ LISTEN / {
split($4,ip,":")
printf("%12s\t%5s\t%5s\n", ip[1], $1, ip[2])
}
'

One Comment to “Tidy list of what’s listening on your ports”

  1. [...] List active internet connections ( just servers ) # netstat -l ( without servers ) # netstat -tup or try the useful script noted here [...]


Leave a Reply