You are currently viewing Ifconfig Command 7 Powerful Tricks Every Linux User Must Know

Ifconfig Command 7 Powerful Tricks Every Linux User Must Know

  • Post author:
  • Post last modified:June 22, 2025

The ifconfig command in Linux is a powerful network management utility used to configure, monitor, and troubleshoot network interfaces. However, many new users encounter the frustrating ‘ifconfig command not found’ error—especially on newer distributions like Debian or Ubuntu. In this guide, we cover what is ifconfig, how to use it with real-world examples, and what to do when it doesn’t work.

What is the ifconfig Command?

The ifconfig (interface configuration) command is a CLI tool that displays and configures network interfaces in Unix and Linux systems. It has traditionally been used to assign IP addresses, enable/disable interfaces, and troubleshoot networking issues.

While ifconfig is deprecated in many Linux distributions in favor of the ip command, it remains widely used due to its simplicity and familiarity.

1. How to Check Your IP Address in Linux Using ifconfig

If you want to get your IP address from the command line in Linux, simply run:

ifconfig

The ifconfig output shows your network adapters such as eth0, wlan0, or enp0s3, and their corresponding IPv4 and IPv6 addresses:


eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.12  netmask 255.255.255.0  broadcast 192.168.1.255

Looking for a linux get ip address command line? ifconfig is the simplest answer.

2. How to Fix ‘ifconfig Command Not Found’ in Linux

Many modern distributions like Ubuntu 20.04+ or Debian 11 no longer include ifconfig by default. If you get a ifconfig command not found or debian ifconfig command not found error, install the required package:

sudo apt install net-tools

For Red Hat-based systems:

sudo yum install net-tools

Now you can use ifconfig normally across your Linux system, including ifconfig Ubuntu environments.

3. How to Set Static IP Address via ifconfig

To set an IP address from the Linux command line using ifconfig:

sudo ifconfig eth0 192.168.1.100 netmask 255.255.255.0 up

To configure the gateway, use:

sudo route add default gw 192.168.1.1 eth0

This is handy for quick network setups—especially when troubleshooting connectivity.

4. Enable or Disable a Network Interface

To bring a network interface online, use:

sudo ifconfig eth0 up

To disable it:

sudo ifconfig eth0 down

These commands are useful during network reconfiguration or diagnosing problems.

5. Use ifconfig to Diagnose Interface Errors

The ifconfig command also helps identify transmit/receive errors or dropped packets. Run:

ifconfig -a

Look under ‘RX packets’ and ‘errors’: high error values often indicate faulty cables or misconfigurations.

6. See All Interfaces, Including Disabled Ones

The -a option helps list all interfaces, even those not currently active:

ifconfig -a

Essential when auditing your system or scripting interface discovery tasks.

7. ifconfig vs ipconfig vs ip: What’s the Difference?

CommandPlatformUse Case
ifconfigLinux, Unix (deprecated in some)Manage and view network interfaces
ipconfigWindowsDisplay IP config (see ipconfig /all command)
ipModern LinuxReplacement for ifconfig

Final Thoughts: Should You Still Use ifconfig?

Even though modern distributions lean toward ip, ifconfig is still a valuable skill. Whether you’re in a container, VM, or embedded system, knowing how to use and troubleshoot ifconfig command is essential for every Linux admin.

FAQ

Is ifconfig still supported in Linux?

While deprecated in many distros, ifconfig is still usable and can be installed via net-tools.

How can I find my IP address in Linux without ifconfig?

Use ip a or ip addr show to view your IP address in modern Linux systems.

Why does ‘ifconfig command not found’ appear?

This error appears because the net-tools package is not installed. Use sudo apt install net-tools to fix it.

Is there a Windows equivalent of ifconfig?

Yes, the equivalent is ipconfig on Windows, and ipconfig /all displays full network info.

Should I learn both ifconfig and ip commands?

Yes. While ‘ip’ is the modern standard, understanding both provides deeper Linux networking knowledge.