Getting Currently Connected Network/Wi-Fi IP Address with ipconfig Command on Linux

Tadashi Shigeoka ·  Thu, March 11, 2021

I’ll introduce how I got the IP address of the currently connected network/Wi-Fi on Linux using the ipconfig command.

Linux | リナックス

Background: Want to Get Only the Connected IP Address

I encountered a situation where I wanted to get only the connected IP address so I could pass it to other commands via xargs.

ipconfig getifaddr en0

You can get the connected IP address by running the ipconfig command as follows:

ipconfig getifaddr en0

When I ran this on my macOS environment, I got the following result:

$ ipconfig getifaddr en0
192.168.0.3

That’s all from the Gemba on getting the IP address of currently connected network/Wi-Fi with the ipconfig command.