Ubuntu – How to know what processes are using the network

debiangnomenetworkingUbuntuunix

Sometimes I can see heavy usage of network in my Gnome System Monitor. I wonder what process is downloading/uploading data. Is there any tool which can show me:

  1. what processes are using the Internet
  2. a dynamic real-time view of the download/upload speed of these processes
  3. the details of the connections (e.g. the remote IP, the port number, etc.)

My system is Ubuntu 10.10.

I tried lsof but the output looks so NOT friendly. Maybe there are some tricks to use it? Or there are better alternatives?

Best Answer

netstat --inet -ap will show you what processes are using the internet and what host/port each process is using. If you want IP addresses and not hostnames, use -n. (--inet shows only internet sockets, -a shows both listening and connection sockets, -p shows process name/ID information). You'll probably want to run it with sudo so that it can give you information about all processes.

nethogs will show you how much bandwidth each process is using, but it doesn't tell you what host each process is connecting to.

ntop is a bit heavy, but gives you an overview of network traffic in general.

(netstat is installed by default and nethogs and ntop are available in Ubuntu's repos)

As far I know there's no single utility that puts 1, 2, and 3 together.

Related Topic