How to list outgoing connections on the Linux CLI
A small example of how to show the remote addresses of your connections.
Outgoing TCP connections:
netstat -atn | tr -s ' ' | cut -f5 -d ' ' | grep -v '127.0.0.1'
Outgoing UDP connections:
netstat -aun | tr -s ' ' | cut -f5 -d ' ' | grep -v '127.0.0.1'
On newer systems netstat may not be installed; ss -tn (TCP) and ss -un (UDP) give similar output.
With ss (the modern way)
ss is installed everywhere and can filter by state itself. Only established connections, without the header, with the program that owns them:
ss -tnp state established # TCP, with process names (sudo shows all processes)
ss -tnH state established | awk '{print $4}' | sort -u # just the remote addresses
ss -unp # UDP