How to find my machine's IP address?

computer-networks

Feb 7, 2025 at 10:00 am

source

An IP address is a unique identifier that is used to locate/identify any device on a network. There are two types of IP addresses :

  1. IPv4 : 192.0.2.1
  2. IPv6 : 2001:0000:130F:0000:0000:09C0:876A:130B.

I have been learning Computer Networking and Socket Programming lately, and I need the IP address of my machine(MacOS/Linux) to test my programs, so I figured it out.

ifconfig | grep inet

In the above command, we pipe the networking details of the machine returned by ifconfig command into grep to obtain IPv4 and IPv6 address of the machine.

I'm definitely not going to attach the output screenshot here and reveal my machine's network configs.

xd.