Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to identify NICs on ~20 remote servers (2-6 NICs on every server). To begin with, I want to identify those ready for use and free ones. How can I check the state of the physical media? I know some ways, including ifconfig|grep RUNNING, ethtool, cat /sys/class/net/eth0/carrier, but all they require that the interface is up. I don't want to bring ALL interfaces up. Not sure why, but I don't like to have enabled, but not configured interfaces in the network. Is there a way I can avoid this?

Or am I just wrong and there's nothing bad about all interfaces being up (and not configured)? Even if they are plugged in?

share|improve this question
up vote 3 down vote accepted

ip link show , by default shows all the interfaces, use ip link show up to show only the running interfaces. You could use filters to get the difference.

share|improve this answer
Aha. And the missing cable will show up as NO-CARRIER, right? – minaev Dec 16 '11 at 11:53
Bingo. Thanks. And ip addr show even adds IP addresses to the output. – minaev Dec 16 '11 at 12:01
That doesn't work on my machine (Debian squeeze, skge driver): ip link show shows nothing more than “DOWN”. ip reports the same information as ifconfig and /sys/class/net/ in any case, doesn't it? Do you get link status information from ip that's different from what you get under /sys/class/net or from ifconfig on your machine? Or do you get link status about interfaces that are down in /sys/class/net (I get /sys/class/net/eth0/carrier: Invalid argument)? – Gilles Dec 18 '11 at 1:12
it doesn't work if interface is down. – Vladimir Kunschikov Dec 2 '15 at 14:21

ip link show displays the flag "LOWER_UP" to indicate the cable in plugged. You can also check for /sys/class/net/eth*/operstate or carrier. However, all of these only work for an interface with an IP address bound on it.

share|improve this answer
Interesting information, but doesn't really answer Original Post. – X Tian Mar 21 '14 at 16:45
even if I haven't plugin eth, it will say "up" also. – kangear Apr 17 '15 at 2:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.