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:
In the picture above you can see, among other parameters, the IP address (inet addr) and the MAC address (HWaddr) of your system.
To display the network setting of a specific interface, you can specify the interface in the ifconfig command:
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:
In the example above we have configure the eth0 interface with the IP address of 18.104.22.168 and the subnet mask of 255.255.255.0.
You can also enable and disable an interface using the ifconfig command. Here is how it is done: