第一种,命令法:

/mnt/wifi$ cat /proc/net/dev

Inter-|  Receive                                                | Transmit

face |bytes  packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carriercompressed

lo:      0      0    0  0    0    0        0        0        0      0    0    0  0    0      0        0

eth0:    3439    15  0  0    0    0        0        0        0      0    0    0  0    0      0          0

第二种:dmesg查看日志法,link down是表示拔出网线,link up表示是连接网线。

[110312.799679] r8169 0000:02:00.0 enp2s0: link down
[110347.642299] r8169 0000:02:00.0 enp2s0: link up

  

第三种: ifconfig 查看状态方法。查看红色关键字。

插网线:
/mnt/wifi$ ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 06:ED:B5:C3:AA:23
UP BROADCAST RUNNING MULTICAST  MTU:1500 Metric:1
RX packets:159 errors:0 dropped:0overruns:0 frame:0
TX packets:0 errors:0 dropped:0overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:23822 (23.2 KiB)  TX bytes:0 (0.0 B)
Interrupt:14
拔网线:
/mnt/wifi$ ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 06:ED:B5:C3:AA:23
UP BROADCAST MULTICAST  MTU:1500 Metric:1
RX packets:160 errors:0 dropped:0overruns:0 frame:0
TX packets:0 errors:0 dropped:0overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:24055 (23.4 KiB)  TX bytes:0 (0.0 B)
Interrupt:14

除了这三种简单的,还有其它的代码方式,这个后面有空再研究吧。

最新文章

  1. https 与http 的坑
  2. 【Python】调用WPS V9 API,实现PPT转PDF
  3. C#编程总结(二)多线程基础
  4. js模板引擎
  5. java1.7集合源码阅读: Stack
  6. 解决.Net 4.0 A potentially dangerous Request.Form value was detected from the client 异常
  7. Oracle表空间、段、区和块
  8. erl0001-Erlang 设计原则 process port io
  9. Android Paint和Color类
  10. Idea设置自动导包
  11. poj 1458 Common Subsequence【LCS】
  12. (推荐)jquery.pagination.js分页
  13. HBase Endpoint
  14. BZOJ 1064 假面舞会
  15. #pragma的用法
  16. jQuery.extend()源码解读
  17. ORACLE_INSERT
  18. (转)MySQL存储过程/存储过程与自定义函数的区别
  19. UVa 12186 树形dp
  20. FusionWidgets Cylinder图

热门文章

  1. 自定义模块和grains
  2. tensorflow-serving-gpu 本地编译并使用
  3. Linux Oracle安装
  4. pytorch入门之安装和配置
  5. poj 2349 求最小生成树里面第m长的边
  6. Linux查看某个进程的线程
  7. 3U - 算菜价
  8. HTML第二篇
  9. Mad Libs游戏1
  10. javascript的异步编程