When managing a Linux server, understanding how to inspect network configuration is essential, and the command to show IP address details is a fundamental part of that skill set. While the specific phrase "linux show ip command" is often used by administrators seeking quick syntax, the reality involves a few different tools that provide varying levels of detail. This guide cuts through the noise to explain exactly how to display IP addresses, interface status, and routing information directly from the terminal.
Understanding the Modern Tool: ip
The modern standard for network configuration on nearly every contemporary Linux distribution is the ip utility, which is part of the iproute2 package. This tool has largely replaced the older ifconfig command and provides a robust way to show IP addresses and manage network interfaces. To simply display the address assigned to your primary network interface, you can use a streamlined version of the command that focuses on the object type "addr".
Basic IP Address Display
To execute the most common "linux show ip command" variant, you will use the following syntax. This command filters the output to show only lines containing an internet address, effectively removing noise and presenting just the IP data you need.
This pipeline will return both the IPv4 address (e.g., 192.168.1.100) and the IPv6 address (e.g., fe80::1) associated with all active interfaces. The output includes the network prefix length (like /24), which defines the subnet mask.
Targeted Interface Inspection
If you want to narrow the scope to a specific network interface—such as eth0 or enp0s3—rather than dumping all interfaces, you can specify the interface name directly in the command. This method is significantly cleaner and easier to parse, especially in scripts or when managing multiple servers.
Specifying the Interface
By replacing the generic "show" with the specific interface name, you instruct the tool to focus solely on that hardware or virtual port. This is the ideal "linux show ip command" for troubleshooting a specific connection issue.
ip addr show eth0
The output of this command will provide the MAC address, the current state of the link (UP or DOWN), and the assigned IP addresses with their corresponding subnet masks.
Navigating Routing Tables
Knowing the IP address of an interface is only half the battle; understanding how the machine decides where to send that data is equally critical. The routing table dictates the path packets take to reach other networks, including the default gateway. To view this essential information, you utilize a different function of the ip tool.
Show IP Route
Executing the route command reveals the kernel's routing policy. This is particularly useful for diagnosing connectivity problems or verifying that your default gateway is correctly configured.
ip route show
Look for the "default" entry, which indicates the gateway IP address. You will also see specific network routes that point directly to connected interfaces or via specific hops.
Condensing the Data: Show IP Brief
For administrators who prefer a format similar to legacy Cisco devices or simply want a faster overview, a condensed version is available. While there is no single native command called "show ip brief" in Linux, the functionality is easily replicated using standard text processing tools to create a tight summary of interfaces and addresses.