FreeBSD: What's My IP Address? (How To Find Out)

Written by: Donovan / Last updated: Mar 18, 2022

Need to know your IP address in FreeBSD?

It’s very easy to find out.

FreeBSD: What’s my IP?

Assuming your network interface is em0, to find out your IP address in FreeBSD just use this command:

ifconfig

(see man page )

Look under em0 (or whatever interface you’re using) and you’ll see your network IP address.

How do I get my IP address and nothing else in FreeBSD?

Let’s say you only want to output your IP address and no other information (e.g. for a DWM status bar or something), use this command:

ifconfig wlan0 | grep 'inet' | awk -F ' ' '{ print $2 }'

In this case, I’ve used the wlan0 interface (wifi) but you could replace this with em0 or whatever suits you. This will output your IP (e.g. 192.168.0.2) to shell and nothing else.

View Archive