I'm looking for a good way to get the current total bandwidth usage on a linux machine. I’ve tried iftop, nethogs, but they don’t show real bandwidth usage compared to system monitor; they don’t suit the needs of my project. I want a command which I execute and it returns the current usage for upload and download and nothing else.

I would like also to do it with native Linux tools without installing anything. In fact I’m making a monitoring application, and I want it to be able to monitor computers without the need to install something in each computer the user wants to monitor, that would be great!


4 Answers 4


Use iptraf - http://www.linuxcommand.org/man_pages/iptraf8.html

It's an ncurses based commandline utility which is able to give you statistics on all interfaces on the machine - including bandwidth usage.

  • 7
    not built-in tool Apr 18, 2019 at 9:45
  • Hello I need similar tool but output single line of current bandwidth usage (since login), nload and other are interactive tools I need this to run alert script that show every half hour how much bandwidth i consumed .
    – Salem F
    Oct 14, 2022 at 13:56

There's a lot of tools you can use: nload, bmon, iftop, vnstat, ifstat... and if you want to just get a specific part of their output (for example, upload and download), I'm pretty sure that you can grep/cut/awk the output to make it work for you.

18 commands to monitor network bandwidth on Linux server

  • bmon worked for me in Ubuntu, giving me the present TX and RX of every interface, and a simple graph of the last 60 seconds. Oct 3, 2017 at 4:06
  • 6
    not built-in tool Apr 18, 2019 at 9:45

sysstat collects network stast as well. If you do a "man sar" you will see all the resources you can keep historical data for.

Set it up by putting in cron the command "/usr/lib/sa/sa1" (or /usr/lib64/sa/sa1) and have it run each time you want a data point (e.g. every 5 minutes)

Then you can use "sar" to view your data. Default is today. You can also view historical data for up to 30 days. You can also archive your data off so you can keep it forever (each day's data is about 8mb).

For networking, you would use "sar -n"

Wonderful tool :)

An example:

 testlinux:~ # sar -n DEV | head -10
 Linux (pCITFileSvr01)    11/07/10

 00:00:01        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
 00:05:01           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00
 00:05:01         eth0      9.95      0.12      1.42      0.02      0.00      0.00      0.00
 00:10:01           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00
 00:10:01         eth0     10.20      0.04      1.44      0.00      0.00      0.00      0.00
 00:15:01           lo      0.00      0.00      0.00      0.00      0.00       0.00      0.00
 00:15:01         eth0     10.32      0.12      1.50      0.02      0.00      0.00      0.00
 00:20:01           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00
 testlinux:~ #

Alright after I did bit of research I found this solution in short it uses netstat to summaries network usage.. Here Is my modfied command

netstat -e -n -i | grep wlan0  -A 5 | grep 'RX packets' |  tail -1

Output example:-

RX packets 76639  bytes 73706194 (70.2 MiB)

Change wlan0 with your card interface name, you can filter more output of that command, e.g

netstat -e -n -i | grep wlan0  -A 5 | grep 'RX packets' |  tail -1 | awk '{print $6$7}'

You must log in to answer this question.

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