Tuesday, January 13, 2009

Linux quick tip

Here's a neat tip I read about in the January 2009 Issue 177 of Linux Journal.

Using netstat with the -tpe flags to monitor programs that are making connections to remote hosts.

-t limits output to TCP connections
-p displays the PID and name of the program
-e displays extra information

Sample:
# netstat -tpe
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
tcp 0 180 10.10.10.9:ssh 10.10.10.8:exlm-agent ESTABLISHED root 11831 2811/sshd: kpb [pri
tcp 0 0 10.10.10.9:39383 yx-in-f104.google.com:http ESTABLISHED kpb 13586 3023/elinks
tcp 0 0 10.10.10.9:49349 cg-in-f100.google.com:http ESTABLISHED kpb 13577 3023/elinks

No comments: