这个脚本会打印指定网络接口的接收和发送的字节数。

#!/bin/bash
interface=eth0
RX=$(cat /sys/class/net/$interface/statistics/rx_bytes)
TX=$(cat /sys/class/net/$interface/statistics/tx_bytes)
echo "Received: $RX"
echo "Transmitted: $TX"


最后修改:2023 年 08 月 24 日
如果觉得我的文章对你有用,请随意赞赏