In ubuntu I can get the networking traffic details via
$ sudo iftop -t -s 1 -L 10
which gives result like this
interface: eth0
IP address is: 192.168.150.2
MAC address is: c0:3f:d5:f6:cb:d3
Listening on eth0
# Host name (port/service if enabled) last 2s last 10s last 40s cumulative
--------------------------------------------------------------------------------------------
1 192.168.203.115 => 128Kb 128Kb 128Kb 31.9KB
13.107.4.50 <= 10.0Mb 10.0Mb 10.0Mb 2.50MB
2 192.168.205.7 => 163Kb 163Kb 163Kb 40.9KB
202.166.193.140 <= 8.08Mb 8.08Mb 8.08Mb 2.02MB
3 192.168.204.103 => 342Kb 342Kb 342Kb 85.5KB
64.15.121.18 <= 6.38Mb 6.38Mb 6.38Mb 1.60MB
4 192.168.204.17 => 81.0Kb 81.0Kb 81.0Kb 20.2KB
13.107.4.50 <= 5.07Mb 5.07Mb 5.07Mb 1.27MB
5 192.168.205.86 => 78.7Kb 78.7Kb 78.7Kb 19.7KB
13.107.4.50 <= 5.06Mb 5.06Mb 5.06Mb 1.26MB
6 192.168.203.83 => 55.2Kb 55.2Kb 55.2Kb 13.8KB
64.71.142.229 <= 3.36Mb 3.36Mb 3.36Mb 859KB
7 192.168.205.23 => 52.5Kb 52.5Kb 52.5Kb 13.1KB
139.5.69.13 <= 3.05Mb 3.05Mb 3.05Mb 781KB
8 192.168.203.87 => 58.0Kb 58.0Kb 58.0Kb 14.5KB
139.5.70.14 <= 2.62Mb 2.62Mb 2.62Mb 671KB
9 192.168.204.224 => 74.1Kb 74.1Kb 74.1Kb 18.5KB
202.166.193.145 <= 2.23Mb 2.23Mb 2.23Mb 571KB
10 192.168.204.16 => 47.5Kb 47.5Kb 47.5Kb 11.9KB
139.5.70.13 <= 1.90Mb 1.90Mb 1.90Mb 487KB
--------------------------------------------------------------------------------------------
Total send rate: 3.01Mb 3.01Mb 3.01Mb
Total receive rate: 67.7Mb 67.7Mb 67.7Mb
Total send and receive rate: 70.7Mb 70.7Mb 70.7Mb
--------------------------------------------------------------------------------------------
Peak rate (sent/received/total): 3.01Mb 67.7Mb 70.7Mb
Cumulative (sent/received/total): 771KB 16.9MB 17.7MB
============================================================================================
But we know we used sudo there. I am working for page in university where i can show this result interactivly probably on charts. But I cannot get the output as it need sudo command .
I made command like this
$ php artisan university:internet
Which in turn calls that sudo command
I know it will give permissions error? Any way or hack to make it possible?
Thanks