0

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)

1

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 linux.com on how to use these iptable options.

| improve this answer | |
1

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
| 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
1

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

| improve this answer | |
0

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

| 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.