Some program was connected from my local ip 111.111.111.111 with 130.239.18.176:80,how to get the pid number? netstat  -np(Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.)Active Internet connections (w/o servers)Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program nametcp        0      0 111.111.111.111:46243    52.89.80.240:443        TIME_WAIT   -               tcp        0      1 111.111.111.111:36553    173.239.79.210:443      SYN_SENT    2630/firefox-esrtcp        0      0 111.111.111.111:48470    130.239.18.176:80       ESTABLISHED -               tcp        0      1 111.111.111.111:36552    173.239.79.210:443      SYN_SENT    2630/firefox-esrtcp        0      1 111.111.111.111:34202    74.125.204.101:80       SYN_SENT    2630/firefox-esrtcp        0      0 111.111.111.111:52243    203.208.48.79:443       ESTABLISHED 2630/firefox-esrtcp        0      1 111.111.111.111:46521    74.125.203.93:443       SYN_SENT    2630/firefox-esrtcp        0      1 111.111.111.111:34200    74.125.204.101:80       SYN_SENT    2630/firefox-esrtcp        0      0 111.111.111.111:48424    130.239.18.176:80       ESTABLISHED -               tcp        0      0 111.111.111.111:46238    52.89.80.240:443        TIME_WAIT   -               tcp        0      1 111.111.111.111:46523    74.125.203.93:443       SYN_SENT    2630/firefox-esrtcp        0      0 111.111.111.111:34204    74.125.204.101:80       TIME_WAIT   -               tcp        0      0 111.111.111.111:33700    104.24.98.177:443       ESTABLISHED 2630/firefox-esrtcp        0      1 111.111.111.111:34206    74.125.204.101:80       SYN_SENT    2630/firefox-esrtcp        0      0 127.0.0.1:49941         127.0.0.1:80            ESTABLISHED 2630/firefox-esr
How to get the pid number which connect to external ip?
netstat
The netstat output explains it fairly well:(Not all processes could be identified, non-owned process info   will not be shown, you would have to be root to see it all.)Just run it as root (e.g. sudo netstat -np)