How to detect the physical connected state of a network cable/connector?

后端 未结 15 1399
隐瞒了意图╮
隐瞒了意图╮ 2020-12-04 04:23

In a Linux environment, I need to detect the physical connected or disconnected state of an RJ45 connector to its socket. Preferably using BASH scripting only.

The

15条回答
  •  佛祖请我去吃肉
    2020-12-04 05:09

    Most modern Linux distributions use NetworkManager for this. You could use D-BUS to listen for the events.

    If you want a command-line tool to check the status, you can also use mii-tool, given that you have Ethernet in mind.

提交回复
热议问题