netstat -anp | grep :80 | wc -l 1

netstat -anp | grep :80 | wc -l

netstat -ant | egrep '(:80|:443) .*:.*ESTABLISHED' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c

Here is what the above code is Doing:
1. netstat -ant | egrep ‘(:80|:443) .*:.*ESTABLISHED’
– netstat -ant: This is the command to list all network connections and listening ports.
– egrep ‘(:80|:443) .*:.*ESTABLISHED’: This is the filter to only show connections to ports 80 and 443.
– awk ‘{print $5}’: This is the command to print the 5th column of the output.
– cut -d: -f1: This is the command to remove the port number from the IP address.
– sort | uniq -c: This is the command to sort the IP addresses and count the number of occurrences.

Similar Posts