Linux Terminal Command: ifconfig

The ifconfig command is an essential tool in Network Utilities. In this tutorial, we will explore what ifconfig does, look at everyday examples, and cover advanced options to supercharge your command-line workflow.


Concept & Explanation

The ifconfig command is a legacy tool used to display or configure active network cards.


Common Options & Syntax

ifconfig [options] [arguments]

Here are the most common flags used with ifconfig:


1. Interactive Example (Simple)

Here is how most people run the command:

# Example
ifconfig

What it does: Lists active network adapters and IP configurations.


2. Power-User Example (Advanced)

For scripting and advanced diagnostics, use this configuration:

# Advanced
sudo ifconfig eth0 192.168.1.50 netmask 255.255.255.0

What it does: Manually assigns a static IP address and subnet mask to the ’eth0’ network adapter.


⚙️ Warning & Common Pitfalls

[!WARNING] ifconfig is deprecated. Use ip addr or ip link on modern distributions.


Here are some related posts on cli_tty1 you might want to check out: