Get free ebooK with 50 must do coding Question for Product Based Companies solved
Fill the details & get ebook over email
Thank You!
We have sent the Ebook on 50 Must Do Coding Questions for Product Based Companies Solved over your email. All the best!

ifconfig Command in Linux with Examples

Last Updated on November 24, 2023 by Abhishek Sharma

Linux users frequently interact with the command line interface to manage network configurations. Among the many indispensable networking tools available, ‘ifconfig’ stands out as a powerful utility for configuring and displaying network interface parameters. Whether you’re a beginner or an experienced user, mastering ‘ifconfig’ can significantly enhance your ability to manage network interfaces efficiently.

This comprehensive guide aims to delve into the ‘ifconfig’ command, covering its functionalities, practical usage scenarios, and a variety of examples to assist users in understanding its versatility in Linux environments.

What is ‘ifconfig’ in Linux?

‘ifconfig’ is a command-line tool primarily used to configure, view, and troubleshoot network interfaces on Linux systems. It provides a comprehensive display of network-related information, including IP addresses, MAC addresses, netmasks, and more.

Syntax of ifconfig Command in Linux:

ifconfig [...OPTIONS] [INTERFACE]

Basic Usage: Displaying Network Interface Information

To view information about all active network interfaces on your system, simply open the terminal and type:


This command will output details for all active interfaces, including their names, IP addresses, MAC addresses, and additional configuration parameters.

Example 1: Displaying Specific Interface Information

Suppose you want detailed information about a particular interface, say ‘eth0’. You can use the following command:

ifconfig eth0

This command will specifically display the details related to the ‘eth0’ network interface, providing information such as IP address, netmask, broadcast address, and more.

Configuring Network Interfaces
‘ifconfig’ also enables users to configure network interfaces with specific parameters. For instance, to assign an IP address to a network interface, you can use the following command:

sudo ifconfig eth0  netmask 

Replace and with the IP address and netmask you want to assign to the ‘eth0’ interface, respectively. Please note that using ‘sudo’ might be necessary to execute this command with administrative privileges.

Example 2: Assigning an IP Address
Let’s say you want to assign the IP address ‘’ with a netmask of ‘’ to the ‘eth0’ interface. You can accomplish this by executing:

sudo ifconfig eth0 netmask

The ‘ifconfig’ command remains a fundamental tool for managing network interfaces in Linux, providing users with the ability to retrieve vital network information and configure interfaces as needed. While ‘ifconfig’ has been widely used for years, it’s important to note that newer versions of Linux distributions are transitioning towards the ‘ip’ command for networking tasks. Nevertheless, understanding ‘ifconfig’ is still valuable for maintaining and troubleshooting networks, making it an essential command-line utility for Linux users.

By exploring the various functionalities and examples provided in this guide, users can leverage ‘ifconfig’ effectively, gaining better control over their network configurations within the Linux environment.

FAQ related to ifconfig command in linux with examples

Here are some Related to ifconfig command in linux with examples.

1. What is the ‘ifconfig’ command in Linux?
‘ifconfig’ is a command-line utility used in Unix-like operating systems, including Linux, to configure and display information about network interfaces on a system. It allows users to view, configure, and manipulate network interface parameters such as IP addresses, netmasks, broadcast addresses, and more.

2. How do I use ‘ifconfig’ to display network interface information?
To display information about all active network interfaces, simply type ‘ifconfig’ in the terminal without any arguments. This command will output details such as interface names, IP addresses, MAC addresses, and other relevant network settings.

3. How can I configure a network interface using ‘ifconfig’?
To configure a network interface with specific parameters, such as setting an IP address or changing the netmask, you can use commands like ‘ifconfig eth0 netmask ‘. However, note that ‘ifconfig’ is being gradually deprecated in favor of the ‘ip’ command, especially in newer Linux distributions.

Leave a Reply

Your email address will not be published. Required fields are marked *