How do I find my IP Address from the command line?

I recognize you can do ifconfig | grep inet, yet that reveals you numerous IPv4 addresses. Just how do I get the details one for SSHing et alia?

2022-06-04 20:33:58
Source Share
Answers: 1

Use ipconfig getifaddr en1 for cordless, or ipconfig getifaddr en0 for ethernet.

ipconfig getifaddr en0 is default for the Wi - Fi network adapter.

Conversely you can additionally do :

dig -4 TXT +short

Output, as an example :
2022-06-04 21:02:10