Sunday, 19 June 2016




GETTING PORT ADDRESS FOR SERVICES :

for x in $(netstat -Aan|grep LISTEN|awk '{print $1}')
do
a=$(netstat -Aan|grep LISTEN|grep $x|awk '{print $5}'|cut -f2 -d .)
b=$(rmsock $x tcpcb|awk '{print $9}')
echo PORT $a is used by
ps -ef |grep $b
done



Flags

       -A
            Shows the address of any protocol control blocks associated with the sockets. This flag acts with the
            default display and is used for debugging purposes.
       -a
            Shows the state of all sockets. Without this flag, sockets used by server processes are not shown.
        -n
            Shows network addresses as numbers. When this flag is not specified, the netstat command interprets
            addresses where possible and displays them symbolically. This flag can be used with any of the display
            formats.

No comments:

Post a Comment