Useful Netstat commands

Check the list of the top 10 using netstat:
# netstat -an | grep 'ESTABLISHED' | awk '{print $4}' | cut -d: -f1 | uniq -c | sort -rn | head -n 10

View all established connections using netstat:
# netstat -an | grep 'ESTABLISHED' | awk '{print $4}' | cut -d: -f1 | uniq -c | sort -rn

Check the largest number of established connections:
# netstat -an | grep 'ESTABLISHED' | awk '{print $4}' | cut -d: -f1 | uniq -c | sort -rn | head -n 1

Check each detail using netstat:
# netstat -an | grep 'ESTABLISHED' | awk '{print $4}' | cut -d: -f1 | uniq -c | sort -rn | more

You can show the port with nestat using:
# netstat -an | grep 'ESTABLISHED' | awk '{print $4}' | uniq -c | sort -rn

0 Comments: