How to get current bandwidth usage from command line using built-in Linux tools?

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!


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.


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