Tag-Archive for » cut «

Wednesday, October 08th, 2008 | Author: Angelo

Hello,

Below is command to find out number of connections from each ip to server using netstat , sort, uniq, awk.

netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

Here is description of Grep used in this command :: Grep is used for sorting lines which are matching for defined pattern but if you want to sort such lines which are matching two or more different pattern then simply define all patterns in single quote and separate them using \| .

Thursday, October 02nd, 2008 | Author: Angelo

Hello,

Below is command to find out number of connections to each port using netstat, cut, awk ,uniq.

netstat -na | grep 'tcp\|udp' | awk '{print $4}' | cut -d: -f2 | sort | uniq -c | awk '{print $2}'

Here, is description for this command so many times you may face trouble because of dos attack in such case you need to find port number (service) on which dos attack is going on above command will help you to search number of connections to each port which is in use.