I am working on Linux and looking for a built-in command which can show current network usage and network bandwidth. The built-in means the commands installed by default with the OS. The commands I can think of are ifconfig, ip, netstat. But I couldn't figure out how to use them to calculate current system bandwidth. Below is an output from ifconfig:

eth0      Link encap:Ethernet  HWaddr 02:42:ac:11:00:02  
          inet addr:  Bcast:  Mask:
          RX packets:21293 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13234 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:12224259 (11.6 MiB)  TX bytes:4552513 (4.3 MiB)

It tells me that the total transferred data is 11.6MB. I can run the command multiple times with an interval between each. Then I can calculate the current network usage on the network interface eth0. But how can I tell the bandwidth of the eth0 interface?

I did some searching and most of the posts suggest to install additional commands through apt-get or yum such as nload, iftop. Since I am building a tool to analyze the network usage on the system, I don't want to add any additional installation requirements to my tools.

  • What does "built-in" mean? Built in to what? What distro are you using? How did you get your VM/host? If I build a package into a VM image, then it's "built in"—so what's wrong with installing a package using the standard package manager for your distribution?
    – Wildcard
    Commented Jan 30, 2018 at 2:50
  • Thanks for your suggestions. I have revised my post. The build-in means the commands shipped with os. Just like the command ifconfig, etc. Commented Jan 30, 2018 at 2:53
  • See previous comment. What OS are you using? How did you install the OS?
    – Wildcard
    Commented Jan 30, 2018 at 2:55
  • Oh...possibly you are looking for the commands netstat, ip and ss. They will take some thorough digging through the man pages to master but you shouldn't have to install them before use. Also lsof has uses in analysis of network traffic, and is installed on a default RHEL 6 installation (though not RHEL 7 which omits many previously default packages). I'm not writing this as an answer because your question is still unclear, and this is just a wild guess.
    – Wildcard
    Commented Jan 30, 2018 at 2:59
  • Well, since this tagged linux there are files in /proc directory which can show number of packets transmitted, if that's what you mean by network usage. But you'd have to write a script to parse it, so it's not "built-in" as in the sense of built-in command to shell. Commented Jan 30, 2018 at 21:17

1 Answer 1


You could try to use the output of ifconfig that yields the total data sent on the interface. Using a bash script you could build your own monitoring utility.

If you can install new software, I'd recommend nethogs.

  • ifconfig gives me the total data sent but how I can calculate the bandwidth? Commented Jan 30, 2018 at 20:53
  • You could grep the total data send and compare it to the values it was a second ago - then you have the data sent by second.
    – mldevw
    Commented Feb 1, 2018 at 5:48

You must log in to answer this question.

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