vnStat is exactly what you want, as it appears. Luckily, it's already in the official universe
repositories.
vnStat is a console-based network traffic monitor. It keeps a log
of 5 minute interval, hourly, daily, monthly and yearly network
traffic for the selected interface(s).
You can simply install it with:
sudo apt install vnstat
... then, statistics will be available later (give it some time) and you can view them with e.g. :
$ vnstat -m
wlp2s0 / monthly
month rx | tx | total | avg. rate
------------------------+-------------+-------------+---------------
2023-01 13.81 GiB | 5.85 GiB | 19.66 GiB | 63.06 kbit/s
2023-02 10.08 GiB | 1.40 GiB | 11.48 GiB | 40.76 kbit/s
2023-03 22.25 GiB | 8.18 GiB | 30.43 GiB | 97.58 kbit/s
2023-04 16.21 GiB | 1.64 GiB | 17.84 GiB | 59.13 kbit/s
2023-05 8.03 GiB | 0.98 GiB | 9.02 GiB | 28.91 kbit/s
2023-06 18.69 GiB | 1.02 GiB | 19.71 GiB | 65.30 kbit/s
2023-07 122.22 GiB | 5.93 GiB | 128.16 GiB | 411.01 kbit/s
2023-08 14.19 GiB | 1.36 GiB | 15.56 GiB | 49.90 kbit/s
2023-09 22.69 GiB | 2.01 GiB | 24.70 GiB | 81.84 kbit/s
2023-10 2.94 GiB | 209.90 MiB | 3.15 GiB | 84.25 kbit/s
------------------------+-------------+-------------+---------------
estimated 24.56 GiB | 1.71 GiB | 26.27 GiB |
for monthly statistics ... or change -m
to -h
, -d
or -y
for hourly, daily or yearly statistics respectively and a lot of features as well.