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
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.
mii-tool