NIS and Linux Networking

How do I list all network interfaces on Linux?

List network interfaces on Linux with ip link, ip -br addr, nmcli and /sys/class/net, and learn what each command shows about state, MAC and IP addresses.

On this page
  1. The quick answer
  2. Using the ip command
  3. Using nmcli with NetworkManager
  4. Reading /sys/class/net
  5. Older ifconfig output
  6. What the interface names mean
  7. Which command to use
  8. Summary

The quick answer

Run ip link show to list every network interface on the machine, with its state and MAC address. For a compact view that also shows IP addresses, run ip -br addr. Both commands are part of the iproute2 package, which most current Linux distributions install by default.

Using the ip command

ip link show lists each interface, including the loopback interface lo. For each one, it shows the name, flags such as UP or LOOPBACK, and the link-layer address, which is the MAC address on Ethernet and Wi-Fi interfaces.

ip -br link gives a shorter, table-style view with one line per interface. It is easier to scan on a machine with many interfaces.

ip -br addr adds the IP addresses assigned to each interface. Use ip -4 addr to show only IPv4 addresses, or ip -6 addr for IPv6.

Using nmcli with NetworkManager

On desktops and many server installs that use NetworkManager, nmcli device status lists each device with its type, state and the connection it belongs to. It is a useful choice when you want to know which interfaces NetworkManager manages. Devices that NetworkManager does not manage may show up with a different state.

Reading /sys/class/net

Linux exposes network interfaces through the sysfs filesystem. Running ls /sys/class/net lists the interface names. Each name has a directory with files such as address, which holds the MAC address, and operstate, which shows whether the link is up. This method works even when the ip command is not available, such as in some minimal rescue environments.

Older ifconfig output

Many older guides use ifconfig -a to list every interface. This command comes from the net-tools package. It is not always installed on newer distributions, and net-tools is largely unmaintained, so use ip where you can. If you see ifconfig in a script, check whether the package is present before you rely on it.

What the interface names mean

The loopback interface is lo, and it is always local to the machine. Wired and wireless interfaces often have names like enp3s0 or wlp2s0. Systemd uses a predictable naming scheme, so the prefix usually hints at the type of interface and where it sits on the bus. Older systems may still use names like eth0 or wlan0.

Interface names can change between installs or hardware, so do not hard-code them in scripts without checking first.

Which command to use

  • To see every interface and its MAC address, use ip link show.
  • To see addresses too, use ip -br addr.
  • To check NetworkManager’s view, use nmcli device status.
  • To read raw data from a minimal system, use ls /sys/class/net.

If you are trying to find the address a device uses on the network, the question What is the unique identifier for a device on a network? is related. The MAC address is the link-layer identifier, and the IP address is the one that changes with the network. For the IP side, read What is an IP address and how does it work in a computer network?

For other tools that help once you know the interface names, see what are the best networking tools for Linux.

Summary

The simplest way to list all network interfaces on Linux is ip link show, with ip -br addr when you also want IP addresses. Use nmcli device status when NetworkManager manages your connections, and ls /sys/class/net when you need a minimal view. Avoid relying on ifconfig, which may not be installed.

The complete guide to nis and linux networking

Network Information System (NIS) in Linux Explained
Read the guide

Keep exploring

Guides from other topics

All topics →