root@localhost:~# watch "netstat | grep -i -e "Foreign" -e "Internet" -e "tcp""
The ‘watch’ command will continuously execute the subsequent command (for more complex commands, as above, the entire set of commands should be enclosed in double-quotes.). By default, ‘watch’ executes every 2 seconds.
The ‘netstat’ command displays network connections (among other things–for more information refer to the Man page.). In this example, grep is used to filter out non-TCP connections.
The ‘grep’ command is used to print lines which match a desired pattern. In this example, ‘-i’ is used to ignore case, and ‘-e’ is used to print multiple patterns. Lines containing ‘tcp’, ‘Foreign’, and ‘Internet’ are printed (the latter two are used to maintain the first two lines of netstat output).
I hope somebody finds this useful. If anyone has suggestions for improvement or spots an error on my part, please feel to share. I welcome feedback!