This is in regard to linux, but if anyone knows of a general *nix method that would be good.

I booted a system yesterday with an ethernet cable plugged in. "NetworkManager" is not installed, so once it started I went to look for the name of the ethernet interface with ifconfig to start a DHCP client manually, but it did not show anything other than lo.

The NIC was listed via lspci, and the appropriate kernel driver was loaded. The system normally uses wifi, and I could remember the interface name for that was wlan0. When I tried ifconfig wlan0 up, wlan0 appeared. But the only ethernet interface names I could remember were eth[N] and em[N] -- neither of which worked.

This document refers to "predictable interface names" but does not do a good job of explaining what they might be in simple terms. It does refer to a piece of source code which implies the name in this case might be deduced from the the PCI bus and slot numbers, which seems like an unnecessarily complicated hassle.

Other searching around led me to believe that this might be determined by systemd in conjunction with udev, but there are almost 100 files in /usr/lib/udev/rules.d and spending an hour trying to determine where (and if) there's a systemd config file for this also seems ridiculous.

It would also be nice to know for certain that they are available, not just how they might be named if they are, so I can rule out hardware problems, etc. Isn't there a simple way to find the names of available network interfaces on linux?

  • In the question you state that you used ip link but then you accept an answer that suggests ip link show which does the exactly same thing. Why? – Pavel Šimerda Apr 23 '14 at 16:07
  • @PavelŠimerda You're right. I might have in fact used ip route -- I wrote this question the next day after the problem was solved (see my own answer); I'm not in the habit of using ip and don't appreciate the excessively spartan man pages, so I probably gave up on it after one try and started going through /sys, since I knew the kmod was loaded, etc. and this was more straightforward to me. I'll remove that completely from the question. – goldilocks Apr 24 '14 at 12:39
  • The manual pages for iproute2 are quite good nowadays, I guess you're using and older version of the package. – Pavel Šimerda Apr 25 '14 at 17:12

The simplest method I know to list all of your interfaces is

ifconfig -a


If you're on a system where that has been made obsolete, you can use

ip link show
  • 3
    If I'd just looked at the man page! Be interesting to know if ip has a parallel, since supposedly ifconfig is being "obsoleted" in favour of that (IMO) more obtuse and less user friendly command. – goldilocks Apr 18 '14 at 15:05
  • 3
    First thing in my man ifconfig: "NOTE This program is obsolete! For replacement check ip..." That may be specific to linux. Hopefully they have to retain it for backward compatibility with something. – goldilocks Apr 18 '14 at 15:09
  • 7
    ifconfig has been deprecated, TMK, so we should be trying to show examples using ip. See the ifconfig wikipedia article: en.wikipedia.org/wiki/Ifconfig. – slm Apr 18 '14 at 16:35
  • 4
    @slm Although the question is (was) linux specific, an example using both seems good as BSD users may be in the habit of looking at "linux" pages anyway -- in fact I'll take linux out of the title and edit a bit (originally this was self-answered and I did not think there was a portable method). – goldilocks Apr 18 '14 at 16:44
  • 7
    ifconfig deprecated? come on. This command has been around for like 30 years. – Michael Martinez Apr 18 '14 at 18:02

The kernel lists them by name in /sys, both separately in (e.g.) the tree of PCI devices -- although finding them there if you don't know where they are to start with is not simple -- and together via symlinks in /sys/class/net. E.g.:

> ls /sys/class/net
em1 lo wlp6so

Another example:

> ls /sys/class/net
lo p6s1 wlan0

If you are not sure which is which, you could just put them all up with either:

ifconfig [name] up 


ip link set [name] up

And then look at the (fairly clear) clues listed by ifconfig (with no arguments). The systemd source code linked from the Freedesktop.org document also refers to:

Two character prefixes based on the type of interface:
 *   en -- ethernet
 *   sl -- serial line IP (slip)
 *   wl -- wlan
 *   ww -- wwan

Although in one of the cases above (p6s1) there is no prefix.

  • The prefix I get for ethernet is eth. I believe en is for wireless lan. – Kaushal Modi Jan 23 '15 at 13:36
  • 4
    @kaushalmodi eth is a linux kernel thing; systemd implements via udev Freedesktop.org's predictable interface names -- the kernel ones are not predictable in the same sense, which is the cause of all the confusion. The quote above is explicitly cut n' pasted from here. There's more to it than that, since I don't have any systemd machines using en for ethernet; the closest is em, others are completely different. You can read the Freedesk.org link in the question yourself for more explanation. – goldilocks Jan 23 '15 at 16:27
  • 4
    [Later] Sometime in the past year Fedora or systemd corrected that? My PCI ethernet is now eno1. – goldilocks Jan 8 '16 at 13:36
  • @goldilocks &c: you can override that by the kernel command line options: biosdevname=0 net.ifnames=0. I never found the systemd way 'predictable' and eth as a prefix seemed reasonable to me so I have always had that. Anyway there it is: you can have it the pseudo-random way (i.e. systemd) or the other way depending on kernel options. – Pryftan Nov 2 '19 at 12:14

I always do cat /proc/net/dev it's simple and easy to memorize

  • 5
    but that only gives active interfaces, not all the interfaces – Grant Bowman Sep 27 '18 at 23:39

ifconfig = Solaris
ipconfig = Windows
ip = Linux

That I know, but am certainly open to additions and corrections.

  • 2
    Huh? ifconfig is Linux also. – fpmurphy Apr 27 '16 at 20:57
  • 5
    @fpmurphy1 Read the first paragraph (after the synopsis) of man ifconfig on a linux system. – goldilocks Apr 27 '16 at 21:21
  • @fpmurphy ifconfig(8) is also deprecated under Linux. Please see the sections NOTES and BUGS. This has been the case for years now. So although ifconfig works under Linux it's not the correct way. – Pryftan Nov 15 '19 at 18:54
  • @Pryftan. Just because a utility is depreciated, does not mean that the utility does not work for your requirements. Correct way? Sorry but Linux does not mandate correct ways. – fpmurphy Nov 26 '19 at 8:51
  • @fpmurphy For some uses however it does not work. Yes it can work but using deprecated ways is - for many cases - just silly. Why would anyone want to use the old way that for all you know could be removed in the future? It's been deprecated for many many years now! Anyway for ifconfig what's the point of using it? ip is more than sufficient. But hey if you like it so be it. I'm just saying that there are reasons it's deprecated! – Pryftan Dec 2 '19 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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