3
Sep

What Connections Have I Got

It is easy to use the utility netstat to list the active connections you have to your machine

netstat -t

provides the information. But often it is good to know which process/program the connection is to. Again netstat obliges

netstat -tp

However, if like me you use 80 column xterms (or even one of the linux VTs in 80 column mode), then the long lines make the output less than easy reading. So using the “cut” utility we can cut down the verbiage to what is important

netstat -tp | cut -c21-63,80-

I often like to use the “--numeric-hosts” option to netstat too.

Another use of netstat is to show those programs that are listening for connections. This can help check if services have crashed, or whether you have unwelcome “services” running on your machine.

netstat -tpl

Again “cut” can be used to trim the fat and keep the output manageable

netstat -tpl | cut -c21-36,56-63,80-

It is worth giving the man page a netstat a check, it is a very useful utility.

Feel free to donate if this post prevented any headaches! Another way to show your appreciation is to take a gander at these relative ads that you may be interested in:


There's 1 Comment So Far

Share your thoughts, leave a comment!