Skip to content

Checking your reading list…

Retry verification

Stay curious. Build better.

Appearance

Choose how BestHub looks on this device.

Changes apply immediately.

Search articles

Open Discover with these filters

Suggested searches

Master Essential Linux Network Commands: ifconfig, host, route & traceroute
Fundamentals 4 min read

Master Essential Linux Network Commands: ifconfig, host, route & traceroute

Learn how to use key Linux networking tools—including ifconfig, host, nslookup, route, and traceroute—to display interface details, query DNS, view routing tables, and trace packet paths, with practical examples, screenshots, and tips such as MAC address spoofing and interface listing.

ifconfig

The ifconfig command, similar to Windows' ipconfig, displays network interfaces, subnet masks, and other details. The left column shows the interface name (e.g., lo for the loopback interface). Below is a screenshot of the command output.

ifconfig output
ifconfig output

Related Tips

1. Print network interface list

By using ifconfig and cut to extract the first ten characters of each line, you can list interface names. Screenshot below.

interface list
interface list

2. MAC address spoofing

In some cases, you may need to spoof a hardware (MAC) address for authentication or filtering. The following command (requires root) changes the MAC address. Screenshot shows the result.

MAC spoof command
MAC spoof command
MAC spoof result
MAC spoof result

host and nslookup

These are DNS lookup tools. host lists all IP addresses for a domain, while nslookup provides detailed DNS information. Example screenshot querying www.baidu.com.

host/nslookup result
host/nslookup result

route

The route command displays the routing table, which contains information about how packets are forwarded. Using the -n option shows addresses numerically. Screenshot below.

route table
route table
route -n output
route -n output

traceroute

traceroute

shows each gateway a packet traverses, helping measure the number of hops to a destination. Example tracing www.baidu.com shows 12 hops.

traceroute result
traceroute result
About this article

For questions about attribution, corrections or content rights, please contactadmin@besthub.devand we will review it promptly.

Report an issue with this article
routingDNSifconfig

Reader feedback

Was this useful?

Useful0

Discussion 0

Questions, practical examples and thoughtful responses.

Open full discussion