The "ifconfig" command in Linux is used to view and configure network interfaces on your system. It provides information about IP addresses, netmasks, broadcast addresses, and more.


Displaying Network Interface Information:

To view the configuration details of all network interfaces on your system, simply run the "ifconfig" command without any arguments:

$ ifconfig

This command will display information about each network interface, including the interface name, IP address, netmask, MAC address, and more.


Displaying Information for a Specific Interface:

If you want to view the details of a specific network interface, specify its name as an argument to the ifconfig command. For example, to view information about the "eth0" interface:

$ ifconfig eth0

This command will display the configuration details for the "eth0" interface, including its IP address, netmask, MAC address, and more.


Enabling or Disabling an Interface:

To enable or disable a network interface, you can use the "up" and "down" options with the ifconfig command. For example, to enable the "eth0" interface:

$ ifconfig eth0 up

And to disable the "eth0" interface:

$ ifconfig eth0 down

These commands will respectively enable or disable the specified network interface.


Assigning an IP Address to an Interface:

You can assign a specific IP address to a network interface using the ifconfig command. Here's an example of assigning the IP address to the "eth0" interface:

$ ifconfig eth0

After running this command, the "eth0" interface will be configured with the specified IP address.


Changing Netmask and Broadcast Address:

To change the netmask or broadcast address of a network interface, use the netmask and broadcast options with the ifconfig command. Here's an example of changing the netmask and broadcast address for the "eth0" interface:

$ ifconfig eth0 netmask broadcast

This command will set the netmask to and the broadcast address to for the "eth0" interface.


Assigning Multiple IP Addresses to an Interface:

It is also possible to assign multiple IP addresses to a single network interface. Use the "alias" option with the ifconfig command to create additional IP addresses for the interface. For example, to assign two additional IP addresses ( and to the "eth0" interface:

$ ifconfig eth0:0
$ ifconfig eth0:1

These commands will create two additional IP aliases (eth0:0 and eth0:1) with the specified IP addresses on the "eth0" interface.


The above examples use the traditional ifconfig command, which is still available in many Linux distributions. However, newer distributions are transitioning to the ip command for network configuration. It is recommended to familiarize yourself with the ip command as well.


Further reading:

     Cheat List of Commonly Used Console Commands in Linux