There are multiple options for that:
1) you can refer to the output of ifconfig <name_of_your_interface>
:
$ /sbin/ifconfig wlan0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet [redacted] netmask 255.255.255.0 broadcast 192.168.1.255
inet6 [redacted] prefixlen 64 scopeid 0x20<link>
ether [redacted] txqueuelen 1000 (Ethernet)
RX packets 2911989 bytes 3104700566 (2.8 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1741814 bytes 307260264 (293.0 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
In the RX bytes line, you have the number of received bytes
RX packets 2911989 bytes 3104700566 (2.8 GiB)
In the TX bytes line, you have the number of sent bytes
TX packets 1741814 bytes 307260264 (293.0 MiB)
2) Refer to How to get TX/RX bytes without ifconfig?:
cat /proc/net/dev
3) You can use netstat -i
(columns RX-OK and TX-OK)
4) ip -s link
5) If you want a live usage, you can use iftop
(may need to be installed with apt
, needs root privileges)
sudo iftop -i wlp2s0
, however, it looks like I have to call it to start recording data usage by myself. I was looking for something constantly doing that in background and then I want to get the information when I want. Your 1st option for example, does this kind of a thing but the problem with it is that it records all the past(I assume) not the current session. – muyustan May 24 '20 at 11:35nmcli
which tells you the current wifi endpoint you are connected to, andvnstat
which monitors the network usage – Musinux May 24 '20 at 11:52