ifconfig command

To display your IP address in Linux, you can use the ifconfig command. This command can also be used to configure, disable and enable a network interface. Used without any options, ifconfig displays network settings of all network interfaces on the system:

linux ifconfig command

In the picture above you can see, among other parameters, the IP address (inet addr) and the MAC address (HWaddr) of your system.

The first Ethernet interface is usually labeled as eth0. The second interface in the example (lo) represents a loopback interface, a special interface that your computer uses to communicate with itself.


To display the network setting of a specific interface, you can specify the interface in the ifconfig command:

linux ifconfig eth0

You can use the ifconfig command to configure an IP address. You need to specify the interface you would like to configure, the IP address and the subnet address. Here is an example:

linux configure an ip address

In the example above we have configure the eth0 interface with the IP address of and the subnet mask of

You can also enable and disable an interface using the ifconfig command. Here is how it is done:

linux ifconfig up down

The disabled network interface is not shown in the output of the ifconfig command, as you can see in the example above.
Geek University 2022