Some Mac OS X Networking Commands in Terminal

For my networking course, we are assigned some labs that require using a Wireshark, a free packet sniffer. These labs have forced me to start learning some basic commands in Terminal. I am currently running Mac OS X 10.11.

To get one's IP address, assuming en1 to be what you want:

ipconfig getifaddr en1

To find your DNS address:

nslookup -type=ns

To flush the DNS cache:

sudo killall -HUP mDNSResponder