Smart Systems for Home

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

Linux Show Network Devices Step-by-Step Guide

· 4 min read · Home Networking

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Real-World Examples
  7. Additional Tools

Displaying network devices in Linux helps identify and troubleshoot hardware and connections. This guide explains how to list them using command-line tools. First, ensure you have terminal access and optionally, administrative privileges for some commands.

What You'll Need

  • Linux system with a terminal
  • Basic command-line familiarity
  • Optional: sudo access for full device details

Step-by-Step

  1. Open the terminal: Press Ctrl + Alt + T or click the terminal icon. This is the gateway to all command-line tools.
  2. Use the ip command: Type ip link show and press Enter. This lists all network interfaces. Look for lines like 1: lo (loopback) and 2: eth0 (Ethernet). Each line starts with a number, followed by a colon, the device name, and then its status. You can also use ip a show or ip addr show to see assigned IP addresses and interface details.
  3. Use the ls command: Type ls /sys/class/net to list network devices in the system's file structure. This directory represents network interfaces as they are recognized by the kernel. The command will return a list of device names like eth0, wlan0, and lo. You can also use ls /dev/net/tun to check for tun devices used in virtual private networks.
  4. Use nmcli for NetworkManager: If NetworkManager is installed, type nmcli device to see device status and type. This tool is particularly useful in desktop environments where GUI tools manage connections. The output will show the device name, type (e.g., Ethernet or Wi-Fi), and its current state (connected, disconnected, etc.). You can also use nmcli device status to see the state of each network device.
  5. Use ifconfig (if available): Some systems still have ifconfig. Type ifconfig to see details of active interfaces. Note: ifconfig is deprecated in favor of ip. While ifconfig still works on many systems, it is no longer maintained and lacks support for newer technologies like VLANs and bridges.
  6. View hardware details with lspci: Type lspci | grep -i network to see network hardware like Ethernet or wireless controllers. This command lists all PCI devices and filters the output for network-related devices. You can also use lspci -v to see detailed information about each device, including vendor and product IDs. This is especially useful when trying to identify the type of network card installed.
  7. Check wireless devices with iwconfig: Type iwconfig to see wireless interface details. Note: iwconfig is deprecated; use iw or nmcli instead. For more detailed wireless information, use iw dev to see device configurations and iw list to see supported features like channel widths and frequencies.

Common Mistakes

Users commonly confuse device names (like eth0 or ens33), and may not know which command to use. ifconfig is outdated and may not show all interfaces. Also, not running commands with sudo can prevent viewing full details. For example, ip link show may not display detailed hardware information without elevated privileges.

Tips

Use ip a (short for ip addr show) to see IP addresses and interface status. For detailed hardware specs, use lshw -class network if installed. Combine ip link with grep for easier filtering, like ip link show | grep 'eth'. You can also use ethtool to get detailed information about a specific device, such as speed, duplex, and driver version. For example, ethtool eth0 will show the current settings of the eth0 interface.

Troubleshooting

If no devices appear, ensure the terminal is open and commands are typed correctly. For missing tools like ip or nmcli, install iproute2 or NetworkManager via your package manager. If wireless is missing, check if the hardware is enabled in BIOS or if drivers are installed. Restarting the network manager with systemctl restart NetworkManager may help. For systems using systemd-networkd, run systemctl restart systemd-networkd to refresh network configurations.

Real-World Examples

Suppose you're trying to diagnose a network issue and need to know which interfaces are active. Running ip link show gives you a list of interfaces and their states (UP/DOWN). If you see 2: eth0: mtu 1500, it means eth0 is up and functioning. If it's DOWN, use ip link set eth0 up to bring it online. If you're working with wireless interfaces and need to see signal strength, use iw dev wlan0 station get to see details like signal quality and noise level.

Additional Tools

For more advanced diagnostics, use arp -a to see connected devices on the local network or tcpdump to capture and analyze network traffic. tcpdump -i eth0 will start capturing packets on eth0. You can also use dhclient eth0 to manually request an IP address from a DHCP server, which is useful when diagnosing IP assignment issues.