Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Ubuntu, how do I figure out which process is a network pig [closed]

Using top it's easy to identify processes that are hogging memory and cpu, but ocasionally I see my computer's network activity spike, but I'm unable to determine which process is generating the activity. Where is the right place to look for this information?

like image 836
Bob Herrmann Avatar asked Mar 31 '09 12:03

Bob Herrmann


People also ask

How do I see what process belongs to a network connection?

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).


4 Answers

You can also take a look at "NetHogs": http://nethogs.sourceforge.net/. Little yet very handy utility. Especially if you want to find out which process is taking the bandwidth.

like image 142
Krzysztof Wilczyński Avatar answered Oct 22 '22 08:10

Krzysztof Wilczyński


You can install several applications to monitor network traffic in real time. NTOP, tcpdump, trafshow, iptraf.

I would go with NTOP or IPTRAF. But that's just a personal taste.

Also, with Linux's netstat you can use the -p flag to see how many connections is a process using.

like image 38
Pablo Santa Cruz Avatar answered Oct 22 '22 08:10

Pablo Santa Cruz


You can also use iftop. In Ubuntu you can install it by typing in terminal: sudo aptitude install iftop. To use type: sudo iftop -i eth0, where eth0 is your network interface.

like image 5
Czubek Avatar answered Oct 22 '22 09:10

Czubek


The package 'nmon' provides a comparable tool to top. The design's a bit different since the kernel doesn't provide excellent statistics via /proc.

Description: performance monitoring tool for Linux
 nmon is a systems administrator, tuner, benchmark tool.
 It can display the CPU, memory, network, disks (mini graphs or numbers),

There's also iftop:

Description: displays bandwidth usage information on an network interface
 iftop does for network usage what top(1) does for CPU usage. It listens to
 network traffic on a named interface and displays a table of current bandwidth
like image 3
jldugger Avatar answered Oct 22 '22 08:10

jldugger