linux命令行查看实时网速
在使用ubuntu desktop的时候,会经常有查看系统当前网速的需求,但是又不愿意花费时间去寻找一款网速查看工具的时候(这样的工具一般都比较臃肿),那么直接在终端里就能用命令查看网速就很需要了。这里我直接用shell来实现:
LANG="" while true do up_time1=`ifconfig $1 | grep "bytes" | awk '{print $6}'` down_time1=`ifconfig $1 | grep "bytes" | awk '{print $2}'` sleep 1 clear up_time2=`ifconfig $1 | grep "bytes" | awk '{print $6}'` down_time2=`ifconfig $1 | grep "bytes" | awk '{print $2}'` up_time1=${up_time1} up_time2=${up_time2} down_time1=${down_time1} down_time2=${down_time2} up_time=`expr $up_time2 - $up_time1` down_time=`expr $down_time2 - $down_time1` up_time=`expr $up_time / 1024` down_time=`expr $down_time / 1024` echo 上传速度: $up_time kb/s echo 下载速度: $down_time kb/s done
最后给该文件添加可执行权限后执行./run.sh wlan0.
需要注意的是,我这里使用的是无线网络,所以网卡选择的是默认的wlan0,如果是有线网络,默认的参数是eth0.
原文地址:https://www.jianshu.com/p/0091324e7088
原文地址:https://www.jianshu.com/p/0091324e7088
相关推荐
-
DVWA-文件上传学习笔记 服务器
2019-7-28
-
Dockerfile 中的 COPY 与 ADD 命令 服务器
2019-3-25
-
如何轻松学习 Kubernetes? 服务器
2020-6-24
-
Vue实际中的应用开发【分页效果与购物车】 服务器
2020-7-1
-
建立博客,使用Docker部署Ghost+MySQL+Nginx 服务器
2019-3-14
-
sql学习和调优 服务器
2019-3-21
-
你的系统如何支撑高并发? 服务器
2019-8-26
-
记一次上线就跪的故障排查案例 服务器
2019-5-9
-
【原创】Linux中断子系统(二)-通用框架处理 服务器
2020-6-11
-
NoSql的对比 服务器
2019-6-27