ifconfig eth1 | grep -v grep | grep bytes | awk '{print $2}' | cut -d ':' -f 2 3527285587
how do I divide the output by 1024/1024 and get the result ..
I am actually trying to calculate the RX bytes and TX Bytes in MB's as given in ifconfig output e.g RX bytes:3675341313 (3.4 GiB) TX bytes:3401591008 (3.1 GiB)
if the NIC is on 100Mb/s ( 12.MB/s) does it mean it can send and receive 12.MB/s at any given point ?? that's what I think and how to check that real time ?
You could pipe it to "bc" provided it is installed, eg:
echo "$(ifconfig eth1 | grep -v grep | grep bytes | awk '{print $2}' | cut -d ':' -f 2) / 1024 / 1024" | bc