List of Useful Netstat Commands


netstatis one of the most useful commands when troubleshooting a network but the syntax can be completely overwhelming. Combine complex syntax with subtle differences between Linux, Linux distributions, and Windows, and all of a sudden you need a handy reference otherwise you can’t use the tool. This purpose of this article is to list a few different scenarios where you might want to use netstat.

List of Useful Netstat Commands

See all TCP/UDP Connections Sorted

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

Find all HTTPS / Port 443 / Website Connections

netstat -anp |grep ':443' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head


See Also

How do deal with an Apache / NGINX server that’s under attack

Leave us a comment if you have any other useful netstat commands that we should list here.

Share this article

Share on facebook
Share on twitter
Share on linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top