Nice things you can do with lsof

# Show all active internet connections
lsof -i

 # Show all active TCP connections
lsof -iTCP
lsof -iTCP:57123 # Show active TCP connection on port 57123


 # Show all active IPv4 connections
lsof -i4
lsof -i4:57123 # Show active IPv4 connection on port 57123


# Show all file descriptors for a user
lsof -u $USER