Script to get the list of services running on system in below format: Protocol – Port – Program Name for LIST in `netstat -nalpe | egrep -i ‘^tcp|^udp’ | grep ‘LISTEN’ | awk ‘{ print $1"|"$4"|"$9 }’`; do PROT=`echo ${LIST} | cut -d"|" -f1`; PORT=`echo ${LIST} | cut -d"|" -f2`; PORT=${PORT##*:}; PROG=`echo ${LIST} | cut…

How to get detail info of TCP or UDP packets

[root@example root]# netstat -u -sUdp:    95043801 packets received    2059 packets to unknown port received.    12041 packet receive errors    81665255 packets sent [root@exampleroot]# netstat -t -sTcp:    2119 active connections openings    14472 passive connection openings    0 failed connection attempts    10 connection resets received    1372 connections established    101805453 segments received    190009367 segments send out    18675 segments retransmited    0…