How to find out the Connected state of a network card in Linux

13
LinuxTerminalIcon-02

Every once in a while, we Linux administrators want to know if a network cable that’s connected to a Linux box is connected or not without having to physically move the machine and checking the connection and watching to see if the little green light blinks.

Thank you for reading this post, don't forget to subscribe!

Linux has a way for administrators to quickly check the status of the connection via the Terminal.  Here’s how:

At the Terminal prompt, type: cat /sys/class/net/enp5s0/carrier

If the output returns with a “1“, then the cable should be connected and talking to the network.

For a more English type of response, enter: cat /sys/class/net/enp5s0/operstate

The output will return by saying “up”.

That’s it.

 

About Post Author

(Visited 43 times, 1 visits today)


Discover more from CompuScoop.com

Subscribe to get the latest posts sent to your email.

Catch up on what you’ve missed:

Verified by MonsterInsights