Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Linux: How to View Network Interfaces Quickly

· 5 min read · Home Networking

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Yes, you can list every network interface on a Linux machine with a handful of commands. The quickest way is to use the built‑in ip command, but tools like ifconfig, nmcli, and ls /sys/class/net also give useful details. Below is a step‑by‑step guide that covers the most common methods, common pitfalls, and troubleshooting tips.

What You'll Need

  • A Linux system with a terminal (SSH or local console).
  • Root or sudo privileges for commands that require elevated rights (e.g., ip link).
  • Basic familiarity with typing commands and reading command output.

Step-by-Step

  1. Open a terminal window. If you are working remotely, use SSH: ssh user@hostname. If you are on the local machine, press Ctrl+Alt+T to launch one.
  2. Check if the ip utility is available. Most modern distributions include it by default. Run: ip -V. The output will look like ip utility, iproute2-5.10.0. If the command is missing, install the iproute2 package with your distribution’s package manager (e.g., sudo apt install iproute2 on Debian/Ubuntu).
  3. List all network interfaces with their state and MAC addresses: ip link show. The output groups each interface with an index number, name, and status. For example:
    1: lo: state UNKNOWN mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    2: eth0: state UP mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
        link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
    
  4. For a concise list that omits the detailed link properties, use: ip -o link show | awk '{print $2,$4,$8}'. This prints the interface name, state, and MAC address in a single line per interface.
  5. If you prefer the older ifconfig style, run: ifconfig -a. This command displays all interfaces, whether active or not. Note that ifconfig is deprecated on many systems, but it is still available in the net-tools package.
  6. To see interfaces managed by NetworkManager, use: nmcli device status. The output shows the device name, type, state, and connection name. This is useful on desktop distributions that rely on NetworkManager for Wi‑Fi and VPN handling.
  7. For a quick glance at the kernel’s view of the network stack, list the directory: ls /sys/class/net. Each entry corresponds to an interface name. This method does not show state or MAC addresses but is handy for scripting.
  8. Optional: To filter interfaces by type, combine ip with grep. For example, to show only Ethernet interfaces: ip -o link show | grep -E 'eth|enp'.
  9. Optional: To display IP addresses assigned to each interface, run: ip -o addr show. The output lists the interface name, address family, and IP address with netmask.
  10. Optional: For wireless interfaces, use iw dev to list wireless devices and their status. This command is part of the iw package.

Common Mistakes

  • Assuming ifconfig is always present. Many modern distributions have removed it by default; installing net-tools is required.
  • Running ip link show without sudo and missing interfaces that require elevated privileges. Use sudo ip link show if you see incomplete output.
  • Misinterpreting the state field. UNKNOWN often means the interface is not configured; DOWN indicates it is administratively disabled.
  • Confusing lo (loopback) with a physical NIC. The loopback interface always exists and is used for local communication.
  • Using nmcli device status on a system that does not run NetworkManager. The command will return an error; use ip link show instead.

Tips

  • Alias common commands in your shell for speed. For example, add alias ipi='ip -o link show' to ~/.bashrc.
  • Use watch -n 1 ip -o link show to monitor interface changes in real time.
  • Combine ip with grep and awk to extract specific fields for scripts.
  • For a GUI view on GNOME, open the Settings app and navigate to Network. The list there mirrors nmcli device status.
  • When troubleshooting, check /var/log/syslog or /var/log/messages for kernel messages about network devices.

Troubleshooting

If an interface does not appear in any list, try the following:

  1. Confirm the hardware is connected and powered on. For USB adapters, check dmesg | grep -i usb to see if the kernel detected it.
  2. Reload the kernel module that manages the interface. For example, for Intel Ethernet: sudo modprobe -r e1000 && sudo modprobe e1000.
  3. Verify that the interface is not blocked by a network manager or firewall. Run rfkill list for wireless devices.
  4. Check the system’s BIOS/UEFI settings for options that disable onboard NICs.
  5. If the interface appears but shows state UNKNOWN, ensure that the driver is loaded correctly. Look for errors in dmesg | grep -i eth.
  6. Restart the networking service: sudo systemctl restart NetworkManager for NetworkManager or sudo systemctl restart networking for the traditional init system.
  7. As a last resort, reboot the machine. Some kernel drivers require a full restart to initialize correctly.

Frequently Asked Questions

What is the difference between ip link show and ifconfig -a?

ip link show is part of the modern iproute2 suite and provides a detailed, structured view of interfaces, including state and MAC address. ifconfig -a is older, shows IP addresses and flags, but is deprecated on many systems.

How can I see only active interfaces?

Use ip link show up or nmcli device status | grep -i connected to filter for interfaces that are administratively up.

Why does my wireless interface show as UNKNOWN?

This usually indicates that the wireless driver has not yet initialized or that the interface is not associated with a network. Check dmesg for driver errors and ensure the Wi‑Fi card is powered on.

Can I use ip to change an interface’s MAC address?

Yes. Use sudo ip link set dev eth0 address 00:11:22:33:44:55. Remember that the change is temporary and will revert after a reboot unless scripted.

Is it safe to run ip link set dev commands without root?

No. Modifying interface settings requires root privileges; running the command without sudo will fail or produce insufficient permissions errors.