Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
2 edited tags
| link
1
source | link

Show network connections of a process

There is a way to show the connections of a process? Something like that:

show PID

in which show is a command to do this, and PID is the pid of the process. The output that I want is composed by all the connection of the process (in real-time). For example, if the process try to connects to 173.194.112.151 the output is 173.194.112.151.

A more specific example with Firefox:

show `pidof firefox`

and with firefox I go at first on google.com, then on unix.stackexchange.com and finally 192.30.252.129. The output, when I close the brower, must be:

google.com
stackexchange.com
192.30.252.129

(Obviously with the browser this output is not realistic, because there are a lot of others related connections, but this is only an example.)