How to find my machine's IP address?
February 07, 2025 | 10:00 AM
A quick, hands-on note on what an IP address is and how to find your own machine’s IPv4 and IPv6 addresses from the terminal. Useful when testing networking or socket programs and a good excuse to get comfortable with basic Unix commands like ifconfig, pipes, and grep.
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 :
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 inetIn 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.