Detect Network Cable Link in Linux

By | 2011/05/04

To check for the presence of a network link, use the command ethtool.

For example, this checks eth0:

# ethtool eth0

or

$ sudo ethtool eth0

Look for a line which says ‘Link detected: yes / no’. The exact output may vary depending on your Linux distribution.


Debian / Ubuntu looks like this:

01ethtool_ubuntu

Red Hat / CentOS looks like this:

02ethtool_redhat

Cool!