How To Find Out The Connected State Of A Network Cable In Linux

Find Out The Connected State Of A Network Cable In Linux
Image source: Google Images

3 Responses

  1. helloworld says:

    ip a
    eth0: mtu 1500 qdisc mq state UP group default qlen 1000
    eth1: mtu 1500 qdisc noop state DOWN group default qlen 1000

  2. TheRealTachyon says:

    Since not everyone has yet been plagued with yet another ridiculous systemd related change in long standing conventions, you should mention that the odd looking network device names in your examples are only for Linux distributions that have migrated to systemd’s “Predictable Network Interface naming” standard which throws out the “eth0” and “wlan0” type device names we’ve been using everywhere for decades.

    Another way to check for cable connection is, (from a root shell):
    Look for “UP” in the output after the device you want to check (eg eth0)

  3. Gurudatta N.R says:

    How to check the network cable is connected/patched in Linux

    You can test Link by it by running mii-tool


    # mii-tool
    eth0: negotiated 100baseTx-FD flow-control, link ok
    eth1: autonegotiation restarted, no link
    eth2: autonegotiation restarted, no link
    eth3: autonegotiation restarted, no link

    How to check the network cable is connected or not in the linux

    for cable in `ls /sys/class/net | grep ^eth`; do printf “$cable: “; cat /sys/class/net/$cable/carrier; done

    if 0(blank) = it would mean cables not connected or unplugged
    if 1 = cable connected, plugged

    more eth0/flags; more eth1/flags; more eth2/flags ; more eth3/flags
    0x1003 << connected

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.