Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a command line program for Linux that will tell me how much is currently being uploaded and downloaded (ie the network "speed").

I want a program that runs, tells me the traffic, then stops. All I've been able to find are live updating applications. (I want to be able to use it similarly to, for example, free, and not, for example, top)

share|improve this question
up vote 1 down vote accepted

iptable rules can be used to count the packets coming in and going out. I have used this capability to troubleshoot network/firewall issue and not for the bandwidth monitoring.

However, iptables does provide options to

create new custom chains
create IP based rules
view counters
reset counters

So using iptable options, a script can do the job for you. An example is given on on how to use these iptable options.

share|improve this answer

You're looking for netstat. A few common switches I use:

  • -n , which tells it not to resolve names and protocols.
  • -a , which tells it to also report ports that are listening.
  • -t , which tells it to just report TCP ports; there's a lot of other stuff reported by netstat
share|improve this answer
If I run netstat -t, would the download speed be the sum of the Recv-Q column, and the upload speed be the sum of the Send-Q column? – Jeffrey Aylesworth Oct 25 '09 at 17:48
@Jeffrey Aylesworth: i think netstat falls more under the 'top' category than the 'free' category. – quack quixote Oct 25 '09 at 18:14
@quack: not at all. Are you confusing it with nettop maybe? – innaM Oct 25 '09 at 18:26
The Recv-Q column is the amount of data that the host has received, but hasn't been processed by the program yet. The Send-Q column shows how much data the program has asked the system to send, but hasn't been sent yet(usually due to bandwidth limitations, but sometimes due to having the command sent at exactly the right time). – Kevin M Oct 26 '09 at 15:58

Give it a try with "vnstat". get it from sourceforge or freshmeat.Wonderful commandline utility to solve your owes.

share|improve this answer

Maybe a bit too much like top, but nload does a decent job.

share|improve this answer
That looks good, but it needs to run, tell me the traffic, then exits. I need to be able to read it from a script. – Jeffrey Aylesworth Oct 25 '09 at 21:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .