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?
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 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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With