netstat: A Powerful Network Connection Viewer For Linux And Windows

In this article, I share with you a cool program which displays the network connections. I was looking for something which offered the same type of view as TinyWall‘s “Show Connections” tab (a firewall for Windows). I didn’t want to load up Wireshark as it’s overkill just for some basic at-a-glance monitoring. With a bit of research, I found out that there is a tool called netstat and it comes even pre-installed with most operating systems!

The way I use netstat is with this command (To exit after running the command below, press CTRL+C):

sudo netstat -natupc

  • -n = numeric (don’t resolve host names)
  • -a = all (display all sockets)
  • -t = TCP (show transmission control protocol connections)
  • -u = UDP (show user datagram protocol connections)
  • -p = programs (display PID/Program name for sockets)
  • -c = continuous (display a continuous list / auto refresh)

I would highly recommend that you create a zsh/bash alias so you don’t have to keep typing it out. Typing it out often can get tedious. You can put the following command in your .zshrc¬†or .bashrc:

alias netlog='sudo netstat -natupc'

 

That’s it folks!

Leave a comment

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

Blue Captcha Image
Refresh

*