Create list of network connections that updates every second, it will tell you:
- what program is using the connection
- what user initiated the connection
- the PID of the program running the connection
- the destination address either by domain name or IP
- the port number that it is connecting through
- what connection protocol is used: udp/tcp/etc
- It will also tell you if a connection is listening or established
watch -n 1 lsof -i -P
BreakdownWatch - Executes a program periodically.
-n 1 - this switch tells Watch to run at an interval of once every 1 second
lsof -This program is used to list open files (everything's a file in linux... even connections)
-i -This tells lsof to only list network/internet related files
-P -This tells lsof to tells lsof to list port numbers instead of converting them to the human readable form (ie it will show 80 instead of HTTP), this helps speed up the command.