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])
}
'
1 Comment
Adjei » Useful Linux commands · March 31, 2006 at 2:04 am
[…] List active internet connections ( just servers ) # netstat -l ( without servers ) # netstat -tup or try the useful script noted here […]
Comments are closed.