lsof is a command meaning “list open files”, which is used in many Unix-like systems to report a list of all open files and the processes that opened them. We will look at ways to keep tab open sockets and Internet files with lsof.
To have a real-time tab on open sockets type in watch lsof -i
List all opened Internet and UNIX domain files use lsof -i -U
Or if you run a webserver and would like to see who is connected to it use lsof -i :80