What is the command in Linux to check the IP address of the local machine?

In Linux, you can use the command `ifconfig` or `ip addr` to check your local IP address.

Use the `ifconfig` command:

ifconfig

After executing this command, information for all network interfaces (including physical and virtual interfaces) will be displayed. You can find your network interface, usually starting with `eth0` or `wlan0`, and look for the `inet` line, followed by the corresponding IP address.

2. Use the command `ip addr`:

ip addr

After running this command, detailed information for all network interfaces will be displayed. You can locate your network interface, which typically starts with `eth0` or `wlan0`, and look for the `inet` line followed by the corresponding IP address.

You can use either of these two commands to view the IP address. In general, the `ip addr` command is more modern and recommended.

bannerAds