Small blog about system administration.

Netstat Commands



1. How to list the connections to port 80

netstat -alntp | grep :80

2. How to check the number of connections to port 80

netstat -alntp | grep :80 | wc -l

3. How to list the remote IPs connecting to your server on port 80

netstat -alntp | grep :80 | awk ‘{print $5}’ | cut -d: -f1 | sort

4. How to list the uniq remote IPs and the number of connections from each IP

netstat -alntp | grep :80 | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

No comments :

Post a Comment